<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998

-}</span><span>
</span><span id="line-6"></span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE CPP, ScopedTypeVariables, MultiWayIf, FlexibleContexts #-}</span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-record-updates #-}</span><span>
</span><span id="line-9"></span><span>
</span><span id="line-10"></span><span class="hs-comment">-- | Types used in the typechecker</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- This module provides the Type interface for front-end parts of the</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- compiler.  These parts</span><span>
</span><span id="line-14"></span><span class="hs-comment">--</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- * treat &quot;source types&quot; as opaque:</span><span>
</span><span id="line-16"></span><span class="hs-comment">--         newtypes, and predicates are meaningful.</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- * look through usage types</span><span>
</span><span id="line-18"></span><span class="hs-comment">--</span><span>
</span><span id="line-19"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Tc.Utils.TcType</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-20"></span><span>  </span><span class="hs-comment">--------------------------------</span><span>
</span><span id="line-21"></span><span>  </span><span class="hs-comment">-- Types</span><span>
</span><span id="line-22"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier">TcType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier">TcSigmaType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcRhoType"><span class="hs-identifier">TcRhoType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTauType"><span class="hs-identifier">TcTauType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcPredType"><span class="hs-identifier">TcPredType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier">TcThetaType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-23"></span><span>  </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier">TcTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyVarSet"><span class="hs-identifier">TcTyVarSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcDTyVarSet"><span class="hs-identifier">TcDTyVarSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyCoVarSet"><span class="hs-identifier">TcTyCoVarSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcDTyCoVarSet"><span class="hs-identifier">TcDTyCoVarSet</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcKind"><span class="hs-identifier">TcKind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcCoVar"><span class="hs-identifier">TcCoVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyCoVar"><span class="hs-identifier">TcTyCoVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyVarBinder"><span class="hs-identifier">TcTyVarBinder</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcInvisTVBinder"><span class="hs-identifier">TcInvisTVBinder</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcReqTVBinder"><span class="hs-identifier">TcReqTVBinder</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyCon"><span class="hs-identifier">TcTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#KnotTied"><span class="hs-identifier">KnotTied</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>
</span><span id="line-27"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpType"><span class="hs-identifier">ExpType</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#InferResult"><span class="hs-identifier">InferResult</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier">ExpSigmaType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpRhoType"><span class="hs-identifier">ExpRhoType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier">mkCheckExpType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-28"></span><span>
</span><span id="line-29"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SyntaxOpType"><span class="hs-identifier">SyntaxOpType</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#synKnownType"><span class="hs-identifier">synKnownType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkSynFunTys"><span class="hs-identifier">mkSynFunTys</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span>  </span><span class="hs-comment">-- TcLevel</span><span>
</span><span id="line-32"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier">TcLevel</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#topTcLevel"><span class="hs-identifier">topTcLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#pushTcLevel"><span class="hs-identifier">pushTcLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTopTcLevel"><span class="hs-identifier">isTopTcLevel</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#strictlyDeeperThan"><span class="hs-identifier">strictlyDeeperThan</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#sameDepthAs"><span class="hs-identifier">sameDepthAs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-34"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTypeLevel"><span class="hs-identifier">tcTypeLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyVarLevel"><span class="hs-identifier">tcTyVarLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#maxTcLevel"><span class="hs-identifier">maxTcLevel</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#promoteSkolem"><span class="hs-identifier">promoteSkolem</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#promoteSkolemX"><span class="hs-identifier">promoteSkolemX</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#promoteSkolemsX"><span class="hs-identifier">promoteSkolemsX</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-36"></span><span>  </span><span class="hs-comment">--------------------------------</span><span>
</span><span id="line-37"></span><span>  </span><span class="hs-comment">-- MetaDetails</span><span>
</span><span id="line-38"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyVarDetails"><span class="hs-identifier">TcTyVarDetails</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#pprTcTyVarDetails"><span class="hs-identifier">pprTcTyVarDetails</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#vanillaSkolemTv"><span class="hs-identifier">vanillaSkolemTv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#superSkolemTv"><span class="hs-identifier">superSkolemTv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-39"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaDetails"><span class="hs-identifier">MetaDetails</span></a></span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Flexi"><span class="hs-identifier">Flexi</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Indirect"><span class="hs-identifier">Indirect</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaInfo"><span class="hs-identifier">MetaInfo</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-40"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isImmutableTyVar"><span class="hs-identifier">isImmutableTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isSkolemTyVar"><span class="hs-identifier">isSkolemTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isMetaTyVar"><span class="hs-identifier">isMetaTyVar</span></a></span><span class="hs-special">,</span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isMetaTyVarTy"><span class="hs-identifier">isMetaTyVarTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#isTyVarTy"><span class="hs-identifier">isTyVarTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-41"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcIsTcTyVar"><span class="hs-identifier">tcIsTcTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyVarTyVar"><span class="hs-identifier">isTyVarTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isOverlappableTyVar"><span class="hs-identifier">isOverlappableTyVar</span></a></span><span class="hs-special">,</span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyConableTyVar"><span class="hs-identifier">isTyConableTyVar</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-42"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFskTyVar"><span class="hs-identifier">isFskTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFmvTyVar"><span class="hs-identifier">isFmvTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFlattenTyVar"><span class="hs-identifier">isFlattenTyVar</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-43"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isAmbiguousTyVar"><span class="hs-identifier">isAmbiguousTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#metaTyVarRef"><span class="hs-identifier">metaTyVarRef</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#metaTyVarInfo"><span class="hs-identifier">metaTyVarInfo</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFlexi"><span class="hs-identifier">isFlexi</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isIndirect"><span class="hs-identifier">isIndirect</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isRuntimeUnkSkol"><span class="hs-identifier">isRuntimeUnkSkol</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-45"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#metaTyVarTcLevel"><span class="hs-identifier">metaTyVarTcLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#setMetaTyVarTcLevel"><span class="hs-identifier">setMetaTyVarTcLevel</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#metaTyVarTcLevel_maybe"><span class="hs-identifier">metaTyVarTcLevel_maybe</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-46"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTouchableMetaTyVar"><span class="hs-identifier">isTouchableMetaTyVar</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-47"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFloatedTouchableMetaTyVar"><span class="hs-identifier">isFloatedTouchableMetaTyVar</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-48"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#findDupTyVarTvs"><span class="hs-identifier">findDupTyVarTvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkTyVarNamePairs"><span class="hs-identifier">mkTyVarNamePairs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-49"></span><span>
</span><span id="line-50"></span><span>  </span><span class="hs-comment">--------------------------------</span><span>
</span><span id="line-51"></span><span>  </span><span class="hs-comment">-- Builders</span><span>
</span><span id="line-52"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkPhiTy"><span class="hs-identifier">mkPhiTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkInfSigmaTy"><span class="hs-identifier">mkInfSigmaTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkSpecSigmaTy"><span class="hs-identifier">mkSpecSigmaTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkSigmaTy"><span class="hs-identifier">mkSigmaTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-53"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkTcAppTy"><span class="hs-identifier">mkTcAppTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkTcAppTys"><span class="hs-identifier">mkTcAppTys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkTcCastTy"><span class="hs-identifier">mkTcCastTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span>  </span><span class="hs-comment">--------------------------------</span><span>
</span><span id="line-56"></span><span>  </span><span class="hs-comment">-- Splitters</span><span>
</span><span id="line-57"></span><span>  </span><span class="hs-comment">-- These are important because they do not look through newtypes</span><span>
</span><span id="line-58"></span><span>  </span><span class="annot"><a href="GHC.Core.Type.html#getTyVar"><span class="hs-identifier">getTyVar</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-59"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTy_maybe"><span class="hs-identifier">tcSplitForAllTy_maybe</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-60"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTys"><span class="hs-identifier">tcSplitForAllTys</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-61"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTysReq"><span class="hs-identifier">tcSplitForAllTysReq</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTysInvis"><span class="hs-identifier">tcSplitForAllTysInvis</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-62"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitPiTys"><span class="hs-identifier">tcSplitPiTys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitPiTy_maybe"><span class="hs-identifier">tcSplitPiTy_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllVarBndrs"><span class="hs-identifier">tcSplitForAllVarBndrs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-63"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitPhiTy"><span class="hs-identifier">tcSplitPhiTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitPredFunTy_maybe"><span class="hs-identifier">tcSplitPredFunTy_maybe</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-64"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTy_maybe"><span class="hs-identifier">tcSplitFunTy_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTys"><span class="hs-identifier">tcSplitFunTys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcFunArgTy"><span class="hs-identifier">tcFunArgTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcFunResultTy"><span class="hs-identifier">tcFunResultTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcFunResultTyN"><span class="hs-identifier">tcFunResultTyN</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-65"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTysN"><span class="hs-identifier">tcSplitFunTysN</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-66"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitTyConApp"><span class="hs-identifier">tcSplitTyConApp</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#tcSplitTyConApp_maybe"><span class="hs-identifier">tcSplitTyConApp_maybe</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-67"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyCon"><span class="hs-identifier">tcTyConAppTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyCon_maybe"><span class="hs-identifier">tcTyConAppTyCon_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConAppArgs"><span class="hs-identifier">tcTyConAppArgs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-68"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTy_maybe"><span class="hs-identifier">tcSplitAppTy_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTy"><span class="hs-identifier">tcSplitAppTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTys"><span class="hs-identifier">tcSplitAppTys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#tcRepSplitAppTy_maybe"><span class="hs-identifier">tcRepSplitAppTy_maybe</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-69"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcRepGetNumAppTys"><span class="hs-identifier">tcRepGetNumAppTys</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-70"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcGetCastedTyVar_maybe"><span class="hs-identifier">tcGetCastedTyVar_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcGetTyVar_maybe"><span class="hs-identifier">tcGetTyVar_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcGetTyVar"><span class="hs-identifier">tcGetTyVar</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-71"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitSigmaTy"><span class="hs-identifier">tcSplitSigmaTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitNestedSigmaTys"><span class="hs-identifier">tcSplitNestedSigmaTys</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-72"></span><span>
</span><span id="line-73"></span><span>  </span><span class="hs-comment">---------------------------------</span><span>
</span><span id="line-74"></span><span>  </span><span class="hs-comment">-- Predicates.</span><span>
</span><span id="line-75"></span><span>  </span><span class="hs-comment">-- Again, newtypes are opaque</span><span>
</span><span id="line-76"></span><span>  </span><span class="annot"><a href="GHC.Core.Type.html#eqType"><span class="hs-identifier">eqType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#eqTypes"><span class="hs-identifier">eqTypes</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#nonDetCmpType"><span class="hs-identifier">nonDetCmpType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#nonDetCmpTypes"><span class="hs-identifier">nonDetCmpTypes</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#eqTypeX"><span class="hs-identifier">eqTypeX</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-77"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#pickyEqType"><span class="hs-identifier">pickyEqType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcEqType"><span class="hs-identifier">tcEqType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcEqKind"><span class="hs-identifier">tcEqKind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcEqTypeNoKindCheck"><span class="hs-identifier">tcEqTypeNoKindCheck</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcEqTypeVis"><span class="hs-identifier">tcEqTypeVis</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-78"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isSigmaTy"><span class="hs-identifier">isSigmaTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isRhoTy"><span class="hs-identifier">isRhoTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isRhoExpTy"><span class="hs-identifier">isRhoExpTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isOverloadedTy"><span class="hs-identifier">isOverloadedTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-79"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFloatingTy"><span class="hs-identifier">isFloatingTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isDoubleTy"><span class="hs-identifier">isDoubleTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFloatTy"><span class="hs-identifier">isFloatTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isIntTy"><span class="hs-identifier">isIntTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isWordTy"><span class="hs-identifier">isWordTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isStringTy"><span class="hs-identifier">isStringTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-80"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isIntegerTy"><span class="hs-identifier">isIntegerTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isNaturalTy"><span class="hs-identifier">isNaturalTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-81"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isBoolTy"><span class="hs-identifier">isBoolTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isUnitTy"><span class="hs-identifier">isUnitTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isCharTy"><span class="hs-identifier">isCharTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isCallStackTy"><span class="hs-identifier">isCallStackTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isCallStackPred"><span class="hs-identifier">isCallStackPred</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-82"></span><span>  </span><span class="annot"><a href="GHC.Core.Type.html#isTauTy"><span class="hs-identifier">isTauTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#isTauTyCon"><span class="hs-identifier">isTauTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcIsTyVarTy"><span class="hs-identifier">tcIsTyVarTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcIsForAllTy"><span class="hs-identifier">tcIsForAllTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-83"></span><span>  </span><span class="annot"><a href="GHC.Core.Type.html#isPredTy"><span class="hs-identifier">isPredTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyVarClassPred"><span class="hs-identifier">isTyVarClassPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyVarHead"><span class="hs-identifier">isTyVarHead</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isInsolubleOccursCheck"><span class="hs-identifier">isInsolubleOccursCheck</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-84"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#checkValidClsArgs"><span class="hs-identifier">checkValidClsArgs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#hasTyVarHead"><span class="hs-identifier">hasTyVarHead</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-85"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isRigidTy"><span class="hs-identifier">isRigidTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier">isAlmostFunctionFree</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span>  </span><span class="hs-comment">---------------------------------</span><span>
</span><span id="line-88"></span><span>  </span><span class="hs-comment">-- Misc type manipulators</span><span>
</span><span id="line-89"></span><span>
</span><span id="line-90"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#deNoteType"><span class="hs-identifier">deNoteType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-91"></span><span>  </span><span class="annot"><a href="GHC.Core.FVs.html#orphNamesOfType"><span class="hs-identifier">orphNamesOfType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.FVs.html#orphNamesOfCo"><span class="hs-identifier">orphNamesOfCo</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-92"></span><span>  </span><span class="annot"><a href="GHC.Core.FVs.html#orphNamesOfTypes"><span class="hs-identifier">orphNamesOfTypes</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.FVs.html#orphNamesOfCoCon"><span class="hs-identifier">orphNamesOfCoCon</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-93"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier">getDFunTyKey</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#evVarPred"><span class="hs-identifier">evVarPred</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span>  </span><span class="hs-comment">---------------------------------</span><span>
</span><span id="line-96"></span><span>  </span><span class="hs-comment">-- Predicate types</span><span>
</span><span id="line-97"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkMinimalBySCs"><span class="hs-identifier">mkMinimalBySCs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#transSuperClasses"><span class="hs-identifier">transSuperClasses</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-98"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#pickQuantifiablePreds"><span class="hs-identifier">pickQuantifiablePreds</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#pickCapturedPreds"><span class="hs-identifier">pickCapturedPreds</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-99"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#immSuperClasses"><span class="hs-identifier">immSuperClasses</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#boxEqPred"><span class="hs-identifier">boxEqPred</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-100"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isImprovementPred"><span class="hs-identifier">isImprovementPred</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span>  </span><span class="annot"><span class="hs-comment">-- * Finding type instances</span></span><span>
</span><span id="line-103"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyFamInsts"><span class="hs-identifier">tcTyFamInsts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyFamInstsAndVis"><span class="hs-identifier">tcTyFamInstsAndVis</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyFamInstsAndVis"><span class="hs-identifier">tcTyConAppTyFamInstsAndVis</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyFamFree"><span class="hs-identifier">isTyFamFree</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span>  </span><span class="annot"><span class="hs-comment">-- * Finding &quot;exact&quot; (non-dead) type variables</span></span><span>
</span><span id="line-106"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#exactTyCoVarsOfType"><span class="hs-identifier">exactTyCoVarsOfType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#exactTyCoVarsOfTypes"><span class="hs-identifier">exactTyCoVarsOfTypes</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-107"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#anyRewritableTyVar"><span class="hs-identifier">anyRewritableTyVar</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-108"></span><span>
</span><span id="line-109"></span><span>  </span><span class="hs-comment">---------------------------------</span><span>
</span><span id="line-110"></span><span>  </span><span class="hs-comment">-- Foreign import and export</span><span>
</span><span id="line-111"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIArgumentTy"><span class="hs-identifier">isFFIArgumentTy</span></a></span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- :: DynFlags -&gt; Safety -&gt; Type -&gt; Bool</span><span>
</span><span id="line-112"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIImportResultTy"><span class="hs-identifier">isFFIImportResultTy</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- :: DynFlags -&gt; Type -&gt; Bool</span><span>
</span><span id="line-113"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIExportResultTy"><span class="hs-identifier">isFFIExportResultTy</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- :: Type -&gt; Bool</span><span>
</span><span id="line-114"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIExternalTy"><span class="hs-identifier">isFFIExternalTy</span></a></span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- :: Type -&gt; Bool</span><span>
</span><span id="line-115"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIDynTy"><span class="hs-identifier">isFFIDynTy</span></a></span><span class="hs-special">,</span><span>          </span><span class="hs-comment">-- :: Type -&gt; Type -&gt; Bool</span><span>
</span><span id="line-116"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIPrimArgumentTy"><span class="hs-identifier">isFFIPrimArgumentTy</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- :: DynFlags -&gt; Type -&gt; Bool</span><span>
</span><span id="line-117"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIPrimResultTy"><span class="hs-identifier">isFFIPrimResultTy</span></a></span><span class="hs-special">,</span><span>   </span><span class="hs-comment">-- :: DynFlags -&gt; Type -&gt; Bool</span><span>
</span><span id="line-118"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFILabelTy"><span class="hs-identifier">isFFILabelTy</span></a></span><span class="hs-special">,</span><span>        </span><span class="hs-comment">-- :: Type -&gt; Bool</span><span>
</span><span id="line-119"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFITy"><span class="hs-identifier">isFFITy</span></a></span><span class="hs-special">,</span><span>             </span><span class="hs-comment">-- :: Type -&gt; Bool</span><span>
</span><span id="line-120"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFunPtrTy"><span class="hs-identifier">isFunPtrTy</span></a></span><span class="hs-special">,</span><span>          </span><span class="hs-comment">-- :: Type -&gt; Bool</span><span>
</span><span id="line-121"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitIOType_maybe"><span class="hs-identifier">tcSplitIOType_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- :: Type -&gt; Maybe Type</span><span>
</span><span id="line-122"></span><span>
</span><span id="line-123"></span><span>  </span><span class="hs-comment">--------------------------------</span><span>
</span><span id="line-124"></span><span>  </span><span class="hs-comment">-- Reexported from Kind</span><span>
</span><span id="line-125"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier">Kind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#tcTypeKind"><span class="hs-identifier">tcTypeKind</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-126"></span><span>  </span><span class="annot"><a href="GHC.Builtin.Types.html#liftedTypeKind"><span class="hs-identifier">liftedTypeKind</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-127"></span><span>  </span><span class="annot"><a href="GHC.Builtin.Types.html#constraintKind"><span class="hs-identifier">constraintKind</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-128"></span><span>  </span><span class="annot"><a href="GHC.Core.Type.html#isLiftedTypeKind"><span class="hs-identifier">isLiftedTypeKind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#isUnliftedTypeKind"><span class="hs-identifier">isUnliftedTypeKind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#classifiesTypeWithValues"><span class="hs-identifier">classifiesTypeWithValues</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-129"></span><span>
</span><span id="line-130"></span><span>  </span><span class="hs-comment">--------------------------------</span><span>
</span><span id="line-131"></span><span>  </span><span class="hs-comment">-- Reexported from Type</span><span>
</span><span id="line-132"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier">Type</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier">PredType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ThetaType"><span class="hs-identifier">ThetaType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyCoBinder"><span class="hs-identifier">TyCoBinder</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-133"></span><span>  </span><span class="annot"><a href="GHC.Types.Var.html#ArgFlag"><span class="hs-identifier">ArgFlag</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#AnonArgFlag"><span class="hs-identifier">AnonArgFlag</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-134"></span><span>
</span><span id="line-135"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkForAllTy"><span class="hs-identifier">mkForAllTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkForAllTys"><span class="hs-identifier">mkForAllTys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkInvisForAllTys"><span class="hs-identifier">mkInvisForAllTys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#mkTyCoInvForAllTys"><span class="hs-identifier">mkTyCoInvForAllTys</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-136"></span><span>  </span><span class="annot"><a href="GHC.Core.Type.html#mkSpecForAllTys"><span class="hs-identifier">mkSpecForAllTys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#mkTyCoInvForAllTy"><span class="hs-identifier">mkTyCoInvForAllTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-137"></span><span>  </span><span class="annot"><a href="GHC.Core.Type.html#mkInfForAllTy"><span class="hs-identifier">mkInfForAllTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#mkInfForAllTys"><span class="hs-identifier">mkInfForAllTys</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-138"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkVisFunTy"><span class="hs-identifier">mkVisFunTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkVisFunTys"><span class="hs-identifier">mkVisFunTys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkInvisFunTy"><span class="hs-identifier">mkInvisFunTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkInvisFunTyMany"><span class="hs-identifier">mkInvisFunTyMany</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-139"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkVisFunTyMany"><span class="hs-identifier">mkVisFunTyMany</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkVisFunTysMany"><span class="hs-identifier">mkVisFunTysMany</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkInvisFunTysMany"><span class="hs-identifier">mkInvisFunTysMany</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-140"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier">mkTyConApp</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#mkAppTy"><span class="hs-identifier">mkAppTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#mkAppTys"><span class="hs-identifier">mkAppTys</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-141"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier">mkTyConTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkTyVarTy"><span class="hs-identifier">mkTyVarTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkTyVarTys"><span class="hs-identifier">mkTyVarTys</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-142"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkTyCoVarTy"><span class="hs-identifier">mkTyCoVarTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkTyCoVarTys"><span class="hs-identifier">mkTyCoVarTys</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span>  </span><span class="annot"><a href="GHC.Core.Predicate.html#isClassPred"><span class="hs-identifier">isClassPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isEqPrimPred"><span class="hs-identifier">isEqPrimPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isIPLikePred"><span class="hs-identifier">isIPLikePred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isEqPred"><span class="hs-identifier">isEqPred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#isEqPredClass"><span class="hs-identifier">isEqPredClass</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-145"></span><span>  </span><span class="annot"><a href="GHC.Core.Predicate.html#mkClassPred"><span class="hs-identifier">mkClassPred</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-146"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitDFunTy"><span class="hs-identifier">tcSplitDFunTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitDFunHead"><span class="hs-identifier">tcSplitDFunHead</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitMethodTy"><span class="hs-identifier">tcSplitMethodTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-147"></span><span>  </span><span class="annot"><a href="GHC.Core.Type.html#isRuntimeRepVar"><span class="hs-identifier">isRuntimeRepVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#isKindLevPoly"><span class="hs-identifier">isKindLevPoly</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-148"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#isVisibleBinder"><span class="hs-identifier">isVisibleBinder</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#isInvisibleBinder"><span class="hs-identifier">isInvisibleBinder</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-149"></span><span>
</span><span id="line-150"></span><span>  </span><span class="hs-comment">-- Type substitutions</span><span>
</span><span id="line-151"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#TCvSubst"><span class="hs-identifier">TCvSubst</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>         </span><span class="hs-comment">-- Representation visible to a few friends</span><span>
</span><span id="line-152"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#TvSubstEnv"><span class="hs-identifier">TvSubstEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#emptyTCvSubst"><span class="hs-identifier">emptyTCvSubst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#mkEmptyTCvSubst"><span class="hs-identifier">mkEmptyTCvSubst</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-153"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#zipTvSubst"><span class="hs-identifier">zipTvSubst</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-154"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#mkTvSubstPrs"><span class="hs-identifier">mkTvSubstPrs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#notElemTCvSubst"><span class="hs-identifier">notElemTCvSubst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#unionTCvSubst"><span class="hs-identifier">unionTCvSubst</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-155"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#getTvSubstEnv"><span class="hs-identifier">getTvSubstEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#setTvSubstEnv"><span class="hs-identifier">setTvSubstEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#getTCvInScope"><span class="hs-identifier">getTCvInScope</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#extendTCvInScope"><span class="hs-identifier">extendTCvInScope</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-156"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#extendTCvInScopeList"><span class="hs-identifier">extendTCvInScopeList</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#extendTCvInScopeSet"><span class="hs-identifier">extendTCvInScopeSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#extendTvSubstAndInScope"><span class="hs-identifier">extendTvSubstAndInScope</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-157"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#lookupTyVar"><span class="hs-identifier">Type.lookupTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#extendTCvSubst"><span class="hs-identifier">Type.extendTCvSubst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTyVarBndr"><span class="hs-identifier">Type.substTyVarBndr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-158"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#extendTvSubst"><span class="hs-identifier">Type.extendTvSubst</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-159"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#isInScope"><span class="hs-identifier">isInScope</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#mkTCvSubst"><span class="hs-identifier">mkTCvSubst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#mkTvSubst"><span class="hs-identifier">mkTvSubst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#zipTyEnv"><span class="hs-identifier">zipTyEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#zipCoEnv"><span class="hs-identifier">zipCoEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-160"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTy"><span class="hs-identifier">Type.substTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTys"><span class="hs-identifier">substTys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substScaledTys"><span class="hs-identifier">substScaledTys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTyWith"><span class="hs-identifier">substTyWith</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTyWithCoVars"><span class="hs-identifier">substTyWithCoVars</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-161"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTyAddInScope"><span class="hs-identifier">substTyAddInScope</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-162"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTyUnchecked"><span class="hs-identifier">substTyUnchecked</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTysUnchecked"><span class="hs-identifier">substTysUnchecked</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substScaledTyUnchecked"><span class="hs-identifier">substScaledTyUnchecked</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-163"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substThetaUnchecked"><span class="hs-identifier">substThetaUnchecked</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-164"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTyWithUnchecked"><span class="hs-identifier">substTyWithUnchecked</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-165"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substCoUnchecked"><span class="hs-identifier">substCoUnchecked</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substCoWithUnchecked"><span class="hs-identifier">substCoWithUnchecked</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-166"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTheta"><span class="hs-identifier">substTheta</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-167"></span><span>
</span><span id="line-168"></span><span>  </span><span class="annot"><a href="GHC.Core.Type.html#isUnliftedType"><span class="hs-identifier">isUnliftedType</span></a></span><span class="hs-special">,</span><span>       </span><span class="hs-comment">-- Source types are always lifted</span><span>
</span><span id="line-169"></span><span>  </span><span class="annot"><a href="GHC.Core.Type.html#isUnboxedTupleType"><span class="hs-identifier">isUnboxedTupleType</span></a></span><span class="hs-special">,</span><span>   </span><span class="hs-comment">-- Ditto</span><span>
</span><span id="line-170"></span><span>  </span><span class="annot"><a href="GHC.Core.Type.html#isPrimitiveType"><span class="hs-identifier">isPrimitiveType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-171"></span><span>
</span><span id="line-172"></span><span>  </span><span class="annot"><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier">tcView</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#coreView"><span class="hs-identifier">coreView</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-173"></span><span>
</span><span id="line-174"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfType"><span class="hs-identifier">tyCoVarsOfType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypes"><span class="hs-identifier">tyCoVarsOfTypes</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.FVs.html#closeOverKinds"><span class="hs-identifier">closeOverKinds</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-175"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.FVs.html#tyCoFVsOfType"><span class="hs-identifier">tyCoFVsOfType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.FVs.html#tyCoFVsOfTypes"><span class="hs-identifier">tyCoFVsOfTypes</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-176"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypeDSet"><span class="hs-identifier">tyCoVarsOfTypeDSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypesDSet"><span class="hs-identifier">tyCoVarsOfTypesDSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.FVs.html#closeOverKindsDSet"><span class="hs-identifier">closeOverKindsDSet</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-177"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypeList"><span class="hs-identifier">tyCoVarsOfTypeList</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypesList"><span class="hs-identifier">tyCoVarsOfTypesList</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-178"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.FVs.html#noFreeVarsOfType"><span class="hs-identifier">noFreeVarsOfType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-179"></span><span>
</span><span id="line-180"></span><span>  </span><span class="hs-comment">--------------------------------</span><span>
</span><span id="line-181"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprKind"><span class="hs-identifier">pprKind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprParendKind"><span class="hs-identifier">pprParendKind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprSigmaType"><span class="hs-identifier">pprSigmaType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-182"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprType"><span class="hs-identifier">pprType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprParendType"><span class="hs-identifier">pprParendType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprTypeApp"><span class="hs-identifier">pprTypeApp</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#pprTyThingCategory"><span class="hs-identifier">pprTyThingCategory</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#tyThingCategory"><span class="hs-identifier">tyThingCategory</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-183"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprTheta"><span class="hs-identifier">pprTheta</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprParendTheta"><span class="hs-identifier">pprParendTheta</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprThetaArrowTy"><span class="hs-identifier">pprThetaArrowTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprClassPred"><span class="hs-identifier">pprClassPred</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-184"></span><span>  </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprTCvBndr"><span class="hs-identifier">pprTCvBndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html#pprTCvBndrs"><span class="hs-identifier">pprTCvBndrs</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-185"></span><span>
</span><span id="line-186"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TypeSize"><span class="hs-identifier">TypeSize</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#sizeType"><span class="hs-identifier">sizeType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#sizeTypes"><span class="hs-identifier">sizeTypes</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.FVs.html#scopedSort"><span class="hs-identifier">scopedSort</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-187"></span><span>
</span><span id="line-188"></span><span>  </span><span class="hs-comment">---------------------------------</span><span>
</span><span id="line-189"></span><span>  </span><span class="hs-comment">-- argument visibility</span><span>
</span><span id="line-190"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConVisibilities"><span class="hs-identifier">tcTyConVisibilities</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isNextTyConArgVisible"><span class="hs-identifier">isNextTyConArgVisible</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isNextArgVisible"><span class="hs-identifier">isNextArgVisible</span></a></span><span>
</span><span id="line-191"></span><span>
</span><span id="line-192"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-196"></span><span class="hs-comment">-- friends:</span><span>
</span><span id="line-197"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html"><span class="hs-identifier">GHC.Core.TyCo.Rep</span></a></span><span>
</span><span id="line-200"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html"><span class="hs-identifier">GHC.Core.TyCo.Subst</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#mkTvSubst"><span class="hs-identifier">mkTvSubst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTyWithCoVars"><span class="hs-identifier">substTyWithCoVars</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-201"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.FVs.html"><span class="hs-identifier">GHC.Core.TyCo.FVs</span></a></span><span>
</span><span id="line-202"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html"><span class="hs-identifier">GHC.Core.TyCo.Ppr</span></a></span><span>
</span><span id="line-203"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Class.html"><span class="hs-identifier">GHC.Core.Class</span></a></span><span>
</span><span id="line-204"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.html"><span class="hs-identifier">GHC.Types.Var</span></a></span><span>
</span><span id="line-205"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.ForeignCall.html"><span class="hs-identifier">GHC.Types.ForeignCall</span></a></span><span>
</span><span id="line-206"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html"><span class="hs-identifier">GHC.Types.Var.Set</span></a></span><span>
</span><span id="line-207"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html"><span class="hs-identifier">GHC.Core.Coercion</span></a></span><span>
</span><span id="line-208"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Type</span></span><span>
</span><span id="line-209"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html"><span class="hs-identifier">GHC.Core.Predicate</span></a></span><span>
</span><span id="line-210"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.RepType.html"><span class="hs-identifier">GHC.Types.RepType</span></a></span><span>
</span><span id="line-211"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-212"></span><span>
</span><span id="line-213"></span><span class="hs-comment">-- others:</span><span>
</span><span id="line-214"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-215"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.FVs.html"><span class="hs-identifier">GHC.Core.FVs</span></a></span><span>
</span><span id="line-216"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Name</span></span><span>
</span><span id="line-217"></span><span>            </span><span class="hs-comment">-- We use this to make dictionaries for type literals.</span><span>
</span><span id="line-218"></span><span>            </span><span class="hs-comment">-- Perhaps there's a better way to do this?</span><span>
</span><span id="line-219"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html"><span class="hs-identifier">GHC.Types.Name.Set</span></a></span><span>
</span><span id="line-220"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html"><span class="hs-identifier">GHC.Types.Var.Env</span></a></span><span>
</span><span id="line-221"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span>
</span><span id="line-222"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html"><span class="hs-identifier">GHC.Builtin.Types</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#coercibleClass"><span class="hs-identifier">coercibleClass</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#eqClass"><span class="hs-identifier">eqClass</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#heqClass"><span class="hs-identifier">heqClass</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#unitTyCon"><span class="hs-identifier">unitTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#unitTyConKey"><span class="hs-identifier">unitTyConKey</span></a></span><span>
</span><span id="line-223"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#listTyCon"><span class="hs-identifier">listTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#constraintKind"><span class="hs-identifier">constraintKind</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-224"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-225"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-226"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html"><span class="hs-identifier">GHC.Data.Maybe</span></a></span><span>
</span><span id="line-227"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.List.SetOps.html"><span class="hs-identifier">GHC.Data.List.SetOps</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Data.List.SetOps.html#getNth"><span class="hs-identifier">getNth</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.List.SetOps.html#findDupsEq"><span class="hs-identifier">findDupsEq</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-228"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-229"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-230"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier">Validity</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#MsgDoc"><span class="hs-identifier">MsgDoc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#isValid"><span class="hs-identifier">isValid</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-231"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.LanguageExtensions.html#"><span class="hs-identifier">GHC.LanguageExtensions</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">LangExt</span></span><span>
</span><span id="line-232"></span><span>
</span><span id="line-233"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Traversable.html#mapAccumL"><span class="hs-identifier">mapAccumL</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-234"></span><span class="hs-comment">-- import Data.Functor.Identity( Identity(..) )</span><span>
</span><span id="line-235"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.IORef.html#"><span class="hs-identifier">Data.IORef</span></a></span><span>
</span><span id="line-236"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.NonEmpty.html#"><span class="hs-identifier">Data.List.NonEmpty</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#NonEmpty"><span class="hs-identifier">NonEmpty</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-237"></span><span>
</span><span id="line-238"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
              Types
*                                                                      *
************************************************************************

The type checker divides the generic Type world into the
following more structured beasts:

sigma ::= forall tyvars. phi
        -- A sigma type is a qualified type
        --
        -- Note that even if 'tyvars' is empty, theta
        -- may not be: e.g.   (?x::Int) =&gt; Int

        -- Note that 'sigma' is in prenex form:
        -- all the foralls are at the front.
        -- A 'phi' type has no foralls to the right of
        -- an arrow

phi :: theta =&gt; rho

rho ::= sigma -&gt; rho
     |  tau

-- A 'tau' type has no quantification anywhere
-- Note that the args of a type constructor must be taus
tau ::= tyvar
     |  tycon tau_1 .. tau_n
     |  tau_1 tau_2
     |  tau_1 -&gt; tau_2

-- In all cases, a (saturated) type synonym application is legal,
-- provided it expands to the required form.

Note [TcTyVars and TyVars in the typechecker]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The typechecker uses a lot of type variables with special properties,
notably being a unification variable with a mutable reference.  These
use the 'TcTyVar' variant of Var.Var.

Note, though, that a /bound/ type variable can (and probably should)
be a TyVar.  E.g
    forall a. a -&gt; a
Here 'a' is really just a deBruijn-number; it certainly does not have
a significant TcLevel (as every TcTyVar does).  So a forall-bound type
variable should be TyVars; and hence a TyVar can appear free in a TcType.

The type checker and constraint solver can also encounter /free/ type
variables that use the 'TyVar' variant of Var.Var, for a couple of
reasons:

  - When typechecking a class decl, say
       class C (a :: k) where
          foo :: T a -&gt; Int
    We have first kind-check the header; fix k and (a:k) to be
    TyVars, bring 'k' and 'a' into scope, and kind check the
    signature for 'foo'.  In doing so we call solveEqualities to
    solve any kind equalities in foo's signature.  So the solver
    may see free occurrences of 'k'.

    See calls to tcExtendTyVarEnv for other places that ordinary
    TyVars are bought into scope, and hence may show up in the types
    and kinds generated by GHC.Tc.Gen.HsType.

  - The pattern-match overlap checker calls the constraint solver,
    long after TcTyVars have been zonked away

It's convenient to simply treat these TyVars as skolem constants,
which of course they are.  We give them a level number of &quot;outermost&quot;,
so they behave as global constants.  Specifically:

* Var.tcTyVarDetails succeeds on a TyVar, returning
  vanillaSkolemTv, as well as on a TcTyVar.

* tcIsTcTyVar returns True for both TyVar and TcTyVar variants
  of Var.Var.  The &quot;tc&quot; prefix means &quot;a type variable that can be
  encountered by the typechecker&quot;.

This is a bit of a change from an earlier era when we remoselessly
insisted on real TcTyVars in the type checker.  But that seems
unnecessary (for skolems, TyVars are fine) and it's now very hard
to guarantee, with the advent of kind equalities.

Note [Coercion variables in free variable lists]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are several places in the GHC codebase where functions like
tyCoVarsOfType, tyCoVarsOfCt, et al. are used to compute the free type
variables of a type. The &quot;Co&quot; part of these functions' names shouldn't be
dismissed, as it is entirely possible that they will include coercion variables
in addition to type variables! As a result, there are some places in GHC.Tc.Utils.TcType
where we must take care to check that a variable is a _type_ variable (using
isTyVar) before calling tcTyVarDetails--a partial function that is not defined
for coercion variables--on the variable. Failing to do so led to
GHC #12785.
-}</span><span>
</span><span id="line-335"></span><span>
</span><span id="line-336"></span><span class="hs-comment">-- See Note [TcTyVars and TyVars in the typechecker]</span><span>
</span><span id="line-337"></span><span class="hs-keyword">type</span><span> </span><span id="TcCoVar"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcCoVar"><span class="hs-identifier hs-var">TcCoVar</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#CoVar"><span class="hs-identifier hs-type">CoVar</span></a></span><span>    </span><span class="hs-comment">-- Used only during type inference</span><span>
</span><span id="line-338"></span><span class="hs-keyword">type</span><span> </span><span id="TcType"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-var">TcType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>      </span><span class="hs-comment">-- A TcType can have mutable type variables</span><span>
</span><span id="line-339"></span><span class="hs-keyword">type</span><span> </span><span id="TcTyCoVar"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyCoVar"><span class="hs-identifier hs-var">TcTyCoVar</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span>    </span><span class="hs-comment">-- Either a TcTyVar or a CoVar</span><span>
</span><span id="line-340"></span><span>        </span><span class="hs-comment">-- Invariant on ForAllTy in TcTypes:</span><span>
</span><span id="line-341"></span><span>        </span><span class="hs-comment">--      forall a. T</span><span>
</span><span id="line-342"></span><span>        </span><span class="hs-comment">-- a cannot occur inside a MutTyVar in T; that is,</span><span>
</span><span id="line-343"></span><span>        </span><span class="hs-comment">-- T is &quot;flattened&quot; before quantifying over a</span><span>
</span><span id="line-344"></span><span>
</span><span id="line-345"></span><span class="hs-keyword">type</span><span> </span><span id="TcTyVarBinder"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyVarBinder"><span class="hs-identifier hs-var">TcTyVarBinder</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyVarBinder"><span class="hs-identifier hs-type">TyVarBinder</span></a></span><span>
</span><span id="line-346"></span><span class="hs-keyword">type</span><span> </span><span id="TcInvisTVBinder"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcInvisTVBinder"><span class="hs-identifier hs-var">TcInvisTVBinder</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#InvisTVBinder"><span class="hs-identifier hs-type">InvisTVBinder</span></a></span><span>
</span><span id="line-347"></span><span class="hs-keyword">type</span><span> </span><span id="TcReqTVBinder"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcReqTVBinder"><span class="hs-identifier hs-var">TcReqTVBinder</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#ReqTVBinder"><span class="hs-identifier hs-type">ReqTVBinder</span></a></span><span>
</span><span id="line-348"></span><span class="hs-keyword">type</span><span> </span><span id="TcTyCon"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyCon"><span class="hs-identifier hs-var">TcTyCon</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>   </span><span class="hs-comment">-- these can be the TcTyCon constructor</span><span>
</span><span id="line-349"></span><span>
</span><span id="line-350"></span><span class="hs-comment">-- These types do not have boxy type variables in them</span><span>
</span><span id="line-351"></span><span class="hs-keyword">type</span><span> </span><span id="TcPredType"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcPredType"><span class="hs-identifier hs-var">TcPredType</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span>
</span><span id="line-352"></span><span class="hs-keyword">type</span><span> </span><span id="TcThetaType"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-var">TcThetaType</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ThetaType"><span class="hs-identifier hs-type">ThetaType</span></a></span><span>
</span><span id="line-353"></span><span class="hs-keyword">type</span><span> </span><span id="TcSigmaType"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier hs-var">TcSigmaType</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span>
</span><span id="line-354"></span><span class="hs-keyword">type</span><span> </span><span id="TcRhoType"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcRhoType"><span class="hs-identifier hs-var">TcRhoType</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span>  </span><span class="hs-comment">-- Note [TcRhoType]</span><span>
</span><span id="line-355"></span><span class="hs-keyword">type</span><span> </span><span id="TcTauType"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTauType"><span class="hs-identifier hs-var">TcTauType</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span>
</span><span id="line-356"></span><span class="hs-keyword">type</span><span> </span><span id="TcKind"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcKind"><span class="hs-identifier hs-var">TcKind</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span>
</span><span id="line-357"></span><span class="hs-keyword">type</span><span> </span><span id="TcTyVarSet"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyVarSet"><span class="hs-identifier hs-var">TcTyVarSet</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#TyVarSet"><span class="hs-identifier hs-type">TyVarSet</span></a></span><span>
</span><span id="line-358"></span><span class="hs-keyword">type</span><span> </span><span id="TcTyCoVarSet"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyCoVarSet"><span class="hs-identifier hs-var">TcTyCoVarSet</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#TyCoVarSet"><span class="hs-identifier hs-type">TyCoVarSet</span></a></span><span>
</span><span id="line-359"></span><span class="hs-keyword">type</span><span> </span><span id="TcDTyVarSet"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcDTyVarSet"><span class="hs-identifier hs-var">TcDTyVarSet</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#DTyVarSet"><span class="hs-identifier hs-type">DTyVarSet</span></a></span><span>
</span><span id="line-360"></span><span class="hs-keyword">type</span><span> </span><span id="TcDTyCoVarSet"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcDTyCoVarSet"><span class="hs-identifier hs-var">TcDTyCoVarSet</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#DTyCoVarSet"><span class="hs-identifier hs-type">DTyCoVarSet</span></a></span><span>
</span><span id="line-361"></span><span>
</span><span id="line-362"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
          ExpType: an &quot;expected type&quot; in the type checker
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-367"></span><span>
</span><span id="line-368"></span><span class="hs-comment">-- | An expected type to check against during type-checking.</span><span>
</span><span id="line-369"></span><span class="hs-comment">-- See Note [ExpType] in &quot;GHC.Tc.Utils.TcMType&quot;, where you'll also find manipulators.</span><span>
</span><span id="line-370"></span><span class="hs-keyword">data</span><span> </span><span id="ExpType"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpType"><span class="hs-identifier hs-var">ExpType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Check"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Check"><span class="hs-identifier hs-var">Check</span></a></span></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span>
</span><span id="line-371"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span id="Infer"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Infer"><span class="hs-identifier hs-var">Infer</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#InferResult"><span class="hs-identifier hs-type">InferResult</span></a></span><span>
</span><span id="line-372"></span><span>
</span><span id="line-373"></span><span class="hs-keyword">data</span><span> </span><span id="InferResult"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#InferResult"><span class="hs-identifier hs-var">InferResult</span></a></span></span><span>
</span><span id="line-374"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="IR"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#IR"><span class="hs-identifier hs-var">IR</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="ir_uniq"><span class="annot"><span class="annottext">InferResult -&gt; Unique
</span><a href="GHC.Tc.Utils.TcType.html#ir_uniq"><span class="hs-identifier hs-var hs-var">ir_uniq</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span>  </span><span class="hs-comment">-- For debugging only</span><span>
</span><span id="line-375"></span><span>
</span><span id="line-376"></span><span>       </span><span class="hs-special">,</span><span> </span><span id="ir_lvl"><span class="annot"><span class="annottext">InferResult -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#ir_lvl"><span class="hs-identifier hs-var hs-var">ir_lvl</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-comment">-- See Note [TcLevel of ExpType] in GHC.Tc.Utils.TcMType</span><span>
</span><span id="line-377"></span><span>
</span><span id="line-378"></span><span>       </span><span class="hs-special">,</span><span> </span><span id="ir_ref"><span class="annot"><span class="annottext">InferResult -&gt; IORef (Maybe Type)
</span><a href="GHC.Tc.Utils.TcType.html#ir_ref"><span class="hs-identifier hs-var hs-var">ir_ref</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-379"></span><span>         </span><span class="hs-comment">-- The type that fills in this hole should be a Type,</span><span>
</span><span id="line-380"></span><span>         </span><span class="hs-comment">-- that is, its kind should be (TYPE rr) for some rr</span><span>
</span><span id="line-381"></span><span>
</span><span id="line-382"></span><span class="hs-keyword">type</span><span> </span><span id="ExpSigmaType"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpSigmaType"><span class="hs-identifier hs-var">ExpSigmaType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpType"><span class="hs-identifier hs-type">ExpType</span></a></span><span>
</span><span id="line-383"></span><span class="hs-keyword">type</span><span> </span><span id="ExpRhoType"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpRhoType"><span class="hs-identifier hs-var">ExpRhoType</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpType"><span class="hs-identifier hs-type">ExpType</span></a></span><span>
</span><span id="line-384"></span><span>
</span><span id="line-385"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680862726"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpType"><span class="hs-identifier hs-type">ExpType</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-386"></span><span>  </span><span id="local-6989586621680862722"><span class="annot"><span class="annottext">ppr :: ExpType -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Check"><span class="hs-identifier hs-type">Check</span></a></span><span> </span><span id="local-6989586621680862720"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862720"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Check&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#braces"><span class="hs-identifier hs-var">braces</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862720"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-387"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Infer"><span class="hs-identifier hs-type">Infer</span></a></span><span> </span><span id="local-6989586621680862716"><span class="annot"><span class="annottext">InferResult
</span><a href="#local-6989586621680862716"><span class="hs-identifier hs-var">ir</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InferResult -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">InferResult
</span><a href="#local-6989586621680862716"><span class="hs-identifier hs-var">ir</span></a></span><span>
</span><span id="line-388"></span><span>
</span><span id="line-389"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680862713"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#InferResult"><span class="hs-identifier hs-type">InferResult</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-390"></span><span>  </span><span id="local-6989586621680862709"><span class="annot"><span class="annottext">ppr :: InferResult -&gt; SDoc
</span><a href="#local-6989586621680862709"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#IR"><span class="hs-identifier hs-type">IR</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ir_uniq :: InferResult -&gt; Unique
</span><a href="GHC.Tc.Utils.TcType.html#ir_uniq"><span class="hs-identifier hs-var">ir_uniq</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862708"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621680862708"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ir_lvl :: InferResult -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#ir_lvl"><span class="hs-identifier hs-var">ir_lvl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862707"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862707"><span class="hs-identifier hs-var">lvl</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-391"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Infer&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#braces"><span class="hs-identifier hs-var">braces</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unique -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621680862708"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#comma"><span class="hs-identifier hs-var">comma</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862707"><span class="hs-identifier hs-var">lvl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-392"></span><span>
</span><span id="line-393"></span><span class="hs-comment">-- | Make an 'ExpType' suitable for checking.</span><span>
</span><span id="line-394"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-type">mkCheckExpType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpType"><span class="hs-identifier hs-type">ExpType</span></a></span><span>
</span><span id="line-395"></span><span id="mkCheckExpType"><span class="annot"><span class="annottext">mkCheckExpType :: Type -&gt; ExpType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var hs-var">mkCheckExpType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ExpType
</span><a href="GHC.Tc.Utils.TcType.html#Check"><span class="hs-identifier hs-var">Check</span></a></span><span>
</span><span id="line-396"></span><span>
</span><span id="line-397"></span><span>
</span><span id="line-398"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
          SyntaxOpType
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span class="hs-comment">-- | What to expect for an argument to a rebindable-syntax operator.</span><span>
</span><span id="line-405"></span><span class="hs-comment">-- Quite like 'Type', but allows for holes to be filled in by tcSyntaxOp.</span><span>
</span><span id="line-406"></span><span class="hs-comment">-- The callback called from tcSyntaxOp gets a list of types; the meaning</span><span>
</span><span id="line-407"></span><span class="hs-comment">-- of these types is determined by a left-to-right depth-first traversal</span><span>
</span><span id="line-408"></span><span class="hs-comment">-- of the 'SyntaxOpType' tree. So if you pass in</span><span>
</span><span id="line-409"></span><span class="hs-comment">--</span><span>
</span><span id="line-410"></span><span class="hs-comment">-- &gt; SynAny `SynFun` (SynList `SynFun` SynType Int) `SynFun` SynAny</span><span>
</span><span id="line-411"></span><span class="hs-comment">--</span><span>
</span><span id="line-412"></span><span class="hs-comment">-- you'll get three types back: one for the first 'SynAny', the /element/</span><span>
</span><span id="line-413"></span><span class="hs-comment">-- type of the list, and one for the last 'SynAny'. You don't get anything</span><span>
</span><span id="line-414"></span><span class="hs-comment">-- for the 'SynType', because you've said positively that it should be an</span><span>
</span><span id="line-415"></span><span class="hs-comment">-- Int, and so it shall be.</span><span>
</span><span id="line-416"></span><span class="hs-comment">--</span><span>
</span><span id="line-417"></span><span class="hs-comment">-- You'll also get three multiplicities back: one for each function arrow. See</span><span>
</span><span id="line-418"></span><span class="hs-comment">-- also Note [Linear types] in Multiplicity.</span><span>
</span><span id="line-419"></span><span class="hs-comment">--</span><span>
</span><span id="line-420"></span><span class="hs-comment">-- This is defined here to avoid defining it in &quot;GHC.Tc.Gen.Expr&quot; boot file.</span><span>
</span><span id="line-421"></span><span class="hs-keyword">data</span><span> </span><span id="SyntaxOpType"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SyntaxOpType"><span class="hs-identifier hs-var">SyntaxOpType</span></a></span></span><span>
</span><span id="line-422"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="SynAny"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SynAny"><span class="hs-identifier hs-var">SynAny</span></a></span></span><span>     </span><span class="hs-comment">-- ^ Any type</span><span>
</span><span id="line-423"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="SynRho"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SynRho"><span class="hs-identifier hs-var">SynRho</span></a></span></span><span>     </span><span class="hs-comment">-- ^ A rho type, skolemised or instantiated as appropriate</span><span>
</span><span id="line-424"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="SynList"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SynList"><span class="hs-identifier hs-var">SynList</span></a></span></span><span>    </span><span class="hs-comment">-- ^ A list type. You get back the element type of the list</span><span>
</span><span id="line-425"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="SynFun"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SynFun"><span class="hs-identifier hs-var">SynFun</span></a></span></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SyntaxOpType"><span class="hs-identifier hs-type">SyntaxOpType</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SyntaxOpType"><span class="hs-identifier hs-type">SyntaxOpType</span></a></span><span>
</span><span id="line-426"></span><span>               </span><span class="hs-comment">-- ^ A function.</span><span>
</span><span id="line-427"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="SynType"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SynType"><span class="hs-identifier hs-var">SynType</span></a></span></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpType"><span class="hs-identifier hs-type">ExpType</span></a></span><span>   </span><span class="hs-comment">-- ^ A known type.</span><span>
</span><span id="line-428"></span><span class="hs-keyword">infixr</span><span> </span><span class="hs-number">0</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SynFun"><span class="hs-operator hs-type">`SynFun`</span></a></span><span>
</span><span id="line-429"></span><span>
</span><span id="line-430"></span><span class="hs-comment">-- | Like 'SynType' but accepts a regular TcType</span><span>
</span><span id="line-431"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#synKnownType"><span class="hs-identifier hs-type">synKnownType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SyntaxOpType"><span class="hs-identifier hs-type">SyntaxOpType</span></a></span><span>
</span><span id="line-432"></span><span id="synKnownType"><span class="annot"><span class="annottext">synKnownType :: Type -&gt; SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#synKnownType"><span class="hs-identifier hs-var hs-var">synKnownType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ExpType -&gt; SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#SynType"><span class="hs-identifier hs-var">SynType</span></a></span><span> </span><span class="annot"><span class="annottext">(ExpType -&gt; SyntaxOpType)
-&gt; (Type -&gt; ExpType) -&gt; Type -&gt; SyntaxOpType
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; ExpType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span>
</span><span id="line-433"></span><span>
</span><span id="line-434"></span><span class="hs-comment">-- | Like 'mkFunTys' but for 'SyntaxOpType'</span><span>
</span><span id="line-435"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkSynFunTys"><span class="hs-identifier hs-type">mkSynFunTys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SyntaxOpType"><span class="hs-identifier hs-type">SyntaxOpType</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpType"><span class="hs-identifier hs-type">ExpType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SyntaxOpType"><span class="hs-identifier hs-type">SyntaxOpType</span></a></span><span>
</span><span id="line-436"></span><span id="mkSynFunTys"><span class="annot"><span class="annottext">mkSynFunTys :: [SyntaxOpType] -&gt; ExpType -&gt; SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#mkSynFunTys"><span class="hs-identifier hs-var hs-var">mkSynFunTys</span></a></span></span><span> </span><span id="local-6989586621680862699"><span class="annot"><span class="annottext">[SyntaxOpType]
</span><a href="#local-6989586621680862699"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span> </span><span id="local-6989586621680862698"><span class="annot"><span class="annottext">ExpType
</span><a href="#local-6989586621680862698"><span class="hs-identifier hs-var">res_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(SyntaxOpType -&gt; SyntaxOpType -&gt; SyntaxOpType)
-&gt; SyntaxOpType -&gt; [SyntaxOpType] -&gt; SyntaxOpType
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxOpType -&gt; SyntaxOpType -&gt; SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#SynFun"><span class="hs-identifier hs-var">SynFun</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ExpType -&gt; SyntaxOpType
</span><a href="GHC.Tc.Utils.TcType.html#SynType"><span class="hs-identifier hs-var">SynType</span></a></span><span> </span><span class="annot"><span class="annottext">ExpType
</span><a href="#local-6989586621680862698"><span class="hs-identifier hs-var">res_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[SyntaxOpType]
</span><a href="#local-6989586621680862699"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>
</span><span id="line-437"></span><span>
</span><span id="line-438"></span><span>
</span><span id="line-439"></span><span class="hs-comment">{-
Note [TcRhoType]
~~~~~~~~~~~~~~~~
A TcRhoType has no foralls or contexts at the top
  NO     forall a. a -&gt;  Int
  NO     Eq a =&gt; a -&gt; a
  YES    a -&gt; a
  YES    (forall a. a-&gt;a) -&gt; Int
  YES    Int -&gt; forall a. a -&gt; Int


************************************************************************
*                                                                      *
        TyVarDetails, MetaDetails, MetaInfo
*                                                                      *
************************************************************************

TyVarDetails gives extra info about type variables, used during type
checking.  It's attached to mutable type variables only.
It's knot-tied back to &quot;GHC.Types.Var&quot;.  There is no reason in principle
why &quot;GHC.Types.Var&quot; shouldn't actually have the definition, but it &quot;belongs&quot; here.

Note [Signature skolems]
~~~~~~~~~~~~~~~~~~~~~~~~
A TyVarTv is a specialised variant of TauTv, with the following invariants:

    * A TyVarTv can be unified only with a TyVar,
      not with any other type

    * Its MetaDetails, if filled in, will always be another TyVarTv
      or a SkolemTv

TyVarTvs are only distinguished to improve error messages.
Consider this

  data T (a:k1) = MkT (S a)
  data S (b:k2) = MkS (T b)

When doing kind inference on {S,T} we don't want *skolems* for k1,k2,
because they end up unifying; we want those TyVarTvs again.


Note [TyVars and TcTyVars during type checking]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Var type has constructors TyVar and TcTyVar.  They are used
as follows:

* TcTyVar: used /only/ during type checking.  Should never appear
  afterwards.  May contain a mutable field, in the MetaTv case.

* TyVar: is never seen by the constraint solver, except locally
  inside a type like (forall a. [a] -&gt;[a]), where 'a' is a TyVar.
  We instantiate these with TcTyVars before exposing the type
  to the constraint solver.

I have swithered about the latter invariant, excluding TyVars from the
constraint solver.  It's not strictly essential, and indeed
(historically but still there) Var.tcTyVarDetails returns
vanillaSkolemTv for a TyVar.

But ultimately I want to seeparate Type from TcType, and in that case
we would need to enforce the separation.
-}</span><span>
</span><span id="line-502"></span><span>
</span><span id="line-503"></span><span class="hs-comment">-- A TyVarDetails is inside a TyVar</span><span>
</span><span id="line-504"></span><span class="hs-comment">-- See Note [TyVars and TcTyVars]</span><span>
</span><span id="line-505"></span><span class="hs-keyword">data</span><span> </span><span id="TcTyVarDetails"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyVarDetails"><span class="hs-identifier hs-var">TcTyVarDetails</span></a></span></span><span>
</span><span id="line-506"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="SkolemTv"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SkolemTv"><span class="hs-identifier hs-var">SkolemTv</span></a></span></span><span>      </span><span class="hs-comment">-- A skolem</span><span>
</span><span id="line-507"></span><span>       </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span>    </span><span class="hs-comment">-- Level of the implication that binds it</span><span>
</span><span id="line-508"></span><span>                  </span><span class="hs-comment">-- See GHC.Tc.Utils.Unify Note [Deeper level on the left] for</span><span>
</span><span id="line-509"></span><span>                  </span><span class="hs-comment">--     how this level number is used</span><span>
</span><span id="line-510"></span><span>       </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>       </span><span class="hs-comment">-- True &lt;=&gt; this skolem type variable can be overlapped</span><span>
</span><span id="line-511"></span><span>                  </span><span class="hs-comment">--          when looking up instances</span><span>
</span><span id="line-512"></span><span>                  </span><span class="hs-comment">-- See Note [Binding when looking up instances] in GHC.Core.InstEnv</span><span>
</span><span id="line-513"></span><span>
</span><span id="line-514"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="RuntimeUnk"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#RuntimeUnk"><span class="hs-identifier hs-var">RuntimeUnk</span></a></span></span><span>    </span><span class="hs-comment">-- Stands for an as-yet-unknown type in the GHCi</span><span>
</span><span id="line-515"></span><span>                  </span><span class="hs-comment">-- interactive context</span><span>
</span><span id="line-516"></span><span>
</span><span id="line-517"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="MetaTv"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-var">MetaTv</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="mtv_info"><span class="annot"><span class="annottext">TcTyVarDetails -&gt; MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#mtv_info"><span class="hs-identifier hs-var hs-var">mtv_info</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaInfo"><span class="hs-identifier hs-type">MetaInfo</span></a></span><span>
</span><span id="line-518"></span><span>           </span><span class="hs-special">,</span><span> </span><span id="mtv_ref"><span class="annot"><span class="annottext">TcTyVarDetails -&gt; IORef MetaDetails
</span><a href="GHC.Tc.Utils.TcType.html#mtv_ref"><span class="hs-identifier hs-var hs-var">mtv_ref</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaDetails"><span class="hs-identifier hs-type">MetaDetails</span></a></span><span>
</span><span id="line-519"></span><span>           </span><span class="hs-special">,</span><span> </span><span id="mtv_tclvl"><span class="annot"><span class="annottext">TcTyVarDetails -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#mtv_tclvl"><span class="hs-identifier hs-var hs-var">mtv_tclvl</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-special">}</span><span>  </span><span class="hs-comment">-- See Note [TcLevel and untouchable type variables]</span><span>
</span><span id="line-520"></span><span>
</span><span id="line-521"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#vanillaSkolemTv"><span class="hs-identifier hs-type">vanillaSkolemTv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#superSkolemTv"><span class="hs-identifier hs-type">superSkolemTv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyVarDetails"><span class="hs-identifier hs-type">TcTyVarDetails</span></a></span><span>
</span><span id="line-522"></span><span class="hs-comment">-- See Note [Binding when looking up instances] in GHC.Core.InstEnv</span><span>
</span><span id="line-523"></span><span id="vanillaSkolemTv"><span class="annot"><span class="annottext">vanillaSkolemTv :: TcTyVarDetails
</span><a href="GHC.Tc.Utils.TcType.html#vanillaSkolemTv"><span class="hs-identifier hs-var hs-var">vanillaSkolemTv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; Bool -&gt; TcTyVarDetails
</span><a href="GHC.Tc.Utils.TcType.html#SkolemTv"><span class="hs-identifier hs-var">SkolemTv</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#topTcLevel"><span class="hs-identifier hs-var">topTcLevel</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>  </span><span class="hs-comment">-- Might be instantiated</span><span>
</span><span id="line-524"></span><span id="superSkolemTv"><span class="annot"><span class="annottext">superSkolemTv :: TcTyVarDetails
</span><a href="GHC.Tc.Utils.TcType.html#superSkolemTv"><span class="hs-identifier hs-var hs-var">superSkolemTv</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; Bool -&gt; TcTyVarDetails
</span><a href="GHC.Tc.Utils.TcType.html#SkolemTv"><span class="hs-identifier hs-var">SkolemTv</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#topTcLevel"><span class="hs-identifier hs-var">topTcLevel</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>   </span><span class="hs-comment">-- Treat this as a completely distinct type</span><span>
</span><span id="line-525"></span><span>                  </span><span class="hs-comment">-- The choice of level number here is a bit dodgy, but</span><span>
</span><span id="line-526"></span><span>                  </span><span class="hs-comment">-- topTcLevel works in the places that vanillaSkolemTv is used</span><span>
</span><span id="line-527"></span><span>
</span><span id="line-528"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680862688"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyVarDetails"><span class="hs-identifier hs-type">TcTyVarDetails</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-529"></span><span>  </span><span id="local-6989586621680862687"><span class="annot"><span class="annottext">ppr :: TcTyVarDetails -&gt; SDoc
</span><a href="#local-6989586621680862687"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVarDetails -&gt; SDoc
</span><a href="GHC.Tc.Utils.TcType.html#pprTcTyVarDetails"><span class="hs-identifier hs-var">pprTcTyVarDetails</span></a></span><span>
</span><span id="line-530"></span><span>
</span><span id="line-531"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#pprTcTyVarDetails"><span class="hs-identifier hs-type">pprTcTyVarDetails</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyVarDetails"><span class="hs-identifier hs-type">TcTyVarDetails</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-532"></span><span class="hs-comment">-- For debugging</span><span>
</span><span id="line-533"></span><span id="pprTcTyVarDetails"><span class="annot"><span class="annottext">pprTcTyVarDetails :: TcTyVarDetails -&gt; SDoc
</span><a href="GHC.Tc.Utils.TcType.html#pprTcTyVarDetails"><span class="hs-identifier hs-var hs-var">pprTcTyVarDetails</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#RuntimeUnk"><span class="hs-identifier hs-type">RuntimeUnk</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;rt&quot;</span></span><span>
</span><span id="line-534"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#pprTcTyVarDetails"><span class="hs-identifier hs-var">pprTcTyVarDetails</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SkolemTv"><span class="hs-identifier hs-type">SkolemTv</span></a></span><span> </span><span id="local-6989586621680862686"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862686"><span class="hs-identifier hs-var">lvl</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ssk&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#colon"><span class="hs-identifier hs-var">colon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862686"><span class="hs-identifier hs-var">lvl</span></a></span><span>
</span><span id="line-535"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#pprTcTyVarDetails"><span class="hs-identifier hs-var">pprTcTyVarDetails</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SkolemTv"><span class="hs-identifier hs-type">SkolemTv</span></a></span><span> </span><span id="local-6989586621680862684"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862684"><span class="hs-identifier hs-var">lvl</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;sk&quot;</span></span><span>  </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#colon"><span class="hs-identifier hs-var">colon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862684"><span class="hs-identifier hs-var">lvl</span></a></span><span>
</span><span id="line-536"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#pprTcTyVarDetails"><span class="hs-identifier hs-var">pprTcTyVarDetails</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_info :: TcTyVarDetails -&gt; MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#mtv_info"><span class="hs-identifier hs-var">mtv_info</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862683"><span class="annot"><span class="annottext">MetaInfo
</span><a href="#local-6989586621680862683"><span class="hs-identifier hs-var">info</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mtv_tclvl :: TcTyVarDetails -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#mtv_tclvl"><span class="hs-identifier hs-var">mtv_tclvl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862682"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862682"><span class="hs-identifier hs-var">tclvl</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-537"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MetaInfo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="#local-6989586621680862683"><span class="hs-identifier hs-var">info</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#colon"><span class="hs-identifier hs-var">colon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862682"><span class="hs-identifier hs-var">tclvl</span></a></span><span>
</span><span id="line-538"></span><span>
</span><span id="line-539"></span><span class="hs-comment">-----------------------------</span><span>
</span><span id="line-540"></span><span class="hs-keyword">data</span><span> </span><span id="MetaDetails"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaDetails"><span class="hs-identifier hs-var">MetaDetails</span></a></span></span><span>
</span><span id="line-541"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="Flexi"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Flexi"><span class="hs-identifier hs-var">Flexi</span></a></span></span><span>  </span><span class="hs-comment">-- Flexi type variables unify to become Indirects</span><span>
</span><span id="line-542"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Indirect"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Indirect"><span class="hs-identifier hs-var">Indirect</span></a></span></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span>
</span><span id="line-543"></span><span>
</span><span id="line-544"></span><span class="hs-keyword">data</span><span> </span><span id="MetaInfo"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaInfo"><span class="hs-identifier hs-var">MetaInfo</span></a></span></span><span>
</span><span id="line-545"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="TauTv"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TauTv"><span class="hs-identifier hs-var">TauTv</span></a></span></span><span>         </span><span class="hs-comment">-- This MetaTv is an ordinary unification variable</span><span>
</span><span id="line-546"></span><span>                   </span><span class="hs-comment">-- A TauTv is always filled in with a tau-type, which</span><span>
</span><span id="line-547"></span><span>                   </span><span class="hs-comment">-- never contains any ForAlls.</span><span>
</span><span id="line-548"></span><span>
</span><span id="line-549"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="TyVarTv"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TyVarTv"><span class="hs-identifier hs-var">TyVarTv</span></a></span></span><span>       </span><span class="hs-comment">-- A variant of TauTv, except that it should not be</span><span>
</span><span id="line-550"></span><span>                   </span><span class="hs-comment">--   unified with a type, only with a type variable</span><span>
</span><span id="line-551"></span><span>                   </span><span class="hs-comment">-- See Note [Signature skolems]</span><span>
</span><span id="line-552"></span><span>
</span><span id="line-553"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="FlatMetaTv"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#FlatMetaTv"><span class="hs-identifier hs-var">FlatMetaTv</span></a></span></span><span>    </span><span class="hs-comment">-- A flatten meta-tyvar</span><span>
</span><span id="line-554"></span><span>                   </span><span class="hs-comment">-- It is a meta-tyvar, but it is always untouchable, with level 0</span><span>
</span><span id="line-555"></span><span>                   </span><span class="hs-comment">-- See Note [The flattening story] in GHC.Tc.Solver.Flatten</span><span>
</span><span id="line-556"></span><span>
</span><span id="line-557"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="FlatSkolTv"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#FlatSkolTv"><span class="hs-identifier hs-var">FlatSkolTv</span></a></span></span><span>    </span><span class="hs-comment">-- A flatten skolem tyvar</span><span>
</span><span id="line-558"></span><span>                   </span><span class="hs-comment">-- Just like FlatMetaTv, but is completely &quot;owned&quot; by</span><span>
</span><span id="line-559"></span><span>                   </span><span class="hs-comment">--   its Given CFunEqCan.</span><span>
</span><span id="line-560"></span><span>                   </span><span class="hs-comment">-- It is filled in /only/ by unflattenGivens</span><span>
</span><span id="line-561"></span><span>                   </span><span class="hs-comment">-- See Note [The flattening story] in GHC.Tc.Solver.Flatten</span><span>
</span><span id="line-562"></span><span>
</span><span id="line-563"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680862675"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaDetails"><span class="hs-identifier hs-type">MetaDetails</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-564"></span><span>  </span><span id="local-6989586621680862673"><span class="annot"><span class="annottext">ppr :: MetaDetails -&gt; SDoc
</span><a href="#local-6989586621680862673"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">MetaDetails
</span><a href="GHC.Tc.Utils.TcType.html#Flexi"><span class="hs-identifier hs-var">Flexi</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Flexi&quot;</span></span><span>
</span><span id="line-565"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Indirect"><span class="hs-identifier hs-type">Indirect</span></a></span><span> </span><span id="local-6989586621680862672"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862672"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Indirect&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862672"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-566"></span><span>
</span><span id="line-567"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680862668"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaInfo"><span class="hs-identifier hs-type">MetaInfo</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-568"></span><span>  </span><span id="local-6989586621680862667"><span class="annot"><span class="annottext">ppr :: MetaInfo -&gt; SDoc
</span><a href="#local-6989586621680862667"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#TauTv"><span class="hs-identifier hs-var">TauTv</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tau&quot;</span></span><span>
</span><span id="line-569"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#TyVarTv"><span class="hs-identifier hs-var">TyVarTv</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tyv&quot;</span></span><span>
</span><span id="line-570"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#FlatMetaTv"><span class="hs-identifier hs-var">FlatMetaTv</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;fmv&quot;</span></span><span>
</span><span id="line-571"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#FlatSkolTv"><span class="hs-identifier hs-var">FlatSkolTv</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;fsk&quot;</span></span><span>
</span><span id="line-572"></span><span>
</span><span id="line-573"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
                Untouchable type variables
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-578"></span><span>
</span><span id="line-579"></span><span class="hs-keyword">newtype</span><span> </span><span id="TcLevel"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-var">TcLevel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="TcLevel"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-var">TcLevel</span></a></span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-keyword">deriving</span><span class="hs-special">(</span><span> </span><span id="local-6989586621680862660"><span id="local-6989586621680862664"><span class="annot"><span class="annottext">TcLevel -&gt; TcLevel -&gt; Bool
(TcLevel -&gt; TcLevel -&gt; Bool)
-&gt; (TcLevel -&gt; TcLevel -&gt; Bool) -&gt; Eq TcLevel
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: TcLevel -&gt; TcLevel -&gt; Bool
$c/= :: TcLevel -&gt; TcLevel -&gt; Bool
== :: TcLevel -&gt; TcLevel -&gt; Bool
$c== :: TcLevel -&gt; TcLevel -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862628"><span id="local-6989586621680862632"><span id="local-6989586621680862636"><span id="local-6989586621680862640"><span id="local-6989586621680862644"><span id="local-6989586621680862648"><span id="local-6989586621680862652"><span class="annot"><span class="annottext">Eq TcLevel
Eq TcLevel
-&gt; (TcLevel -&gt; TcLevel -&gt; Ordering)
-&gt; (TcLevel -&gt; TcLevel -&gt; Bool)
-&gt; (TcLevel -&gt; TcLevel -&gt; Bool)
-&gt; (TcLevel -&gt; TcLevel -&gt; Bool)
-&gt; (TcLevel -&gt; TcLevel -&gt; Bool)
-&gt; (TcLevel -&gt; TcLevel -&gt; TcLevel)
-&gt; (TcLevel -&gt; TcLevel -&gt; TcLevel)
-&gt; Ord TcLevel
TcLevel -&gt; TcLevel -&gt; Bool
TcLevel -&gt; TcLevel -&gt; Ordering
TcLevel -&gt; TcLevel -&gt; TcLevel
forall a.
Eq a
-&gt; (a -&gt; a -&gt; Ordering)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; a)
-&gt; (a -&gt; a -&gt; a)
-&gt; Ord a
min :: TcLevel -&gt; TcLevel -&gt; TcLevel
$cmin :: TcLevel -&gt; TcLevel -&gt; TcLevel
max :: TcLevel -&gt; TcLevel -&gt; TcLevel
$cmax :: TcLevel -&gt; TcLevel -&gt; TcLevel
&gt;= :: TcLevel -&gt; TcLevel -&gt; Bool
$c&gt;= :: TcLevel -&gt; TcLevel -&gt; Bool
&gt; :: TcLevel -&gt; TcLevel -&gt; Bool
$c&gt; :: TcLevel -&gt; TcLevel -&gt; Bool
&lt;= :: TcLevel -&gt; TcLevel -&gt; Bool
$c&lt;= :: TcLevel -&gt; TcLevel -&gt; Bool
&lt; :: TcLevel -&gt; TcLevel -&gt; Bool
$c&lt; :: TcLevel -&gt; TcLevel -&gt; Bool
compare :: TcLevel -&gt; TcLevel -&gt; Ordering
$ccompare :: TcLevel -&gt; TcLevel -&gt; Ordering
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Ord</span></span></span></span></span></span></span></span></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-580"></span><span>  </span><span class="hs-comment">-- See Note [TcLevel and untouchable type variables] for what this Int is</span><span>
</span><span id="line-581"></span><span>  </span><span class="hs-comment">-- See also Note [TcLevel assignment]</span><span>
</span><span id="line-582"></span><span>
</span><span id="line-583"></span><span class="hs-comment">{-
Note [TcLevel and untouchable type variables]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Each unification variable (MetaTv)
  and each Implication
  has a level number (of type TcLevel)

* INVARIANTS.  In a tree of Implications,

    (ImplicInv) The level number (ic_tclvl) of an Implication is
                STRICTLY GREATER THAN that of its parent

    (SkolInv)   The level number of the skolems (ic_skols) of an
                Implication is equal to the level of the implication
                itself (ic_tclvl)

    (GivenInv)  The level number of a unification variable appearing
                in the 'ic_given' of an implication I should be
                STRICTLY LESS THAN the ic_tclvl of I

    (WantedInv) The level number of a unification variable appearing
                in the 'ic_wanted' of an implication I should be
                LESS THAN OR EQUAL TO the ic_tclvl of I
                See Note [WantedInv]

* A unification variable is *touchable* if its level number
  is EQUAL TO that of its immediate parent implication,
  and it is a TauTv or TyVarTv (but /not/ FlatMetaTv or FlatSkolTv)

Note [WantedInv]
~~~~~~~~~~~~~~~~
Why is WantedInv important?  Consider this implication, where
the constraint (C alpha[3]) disobeys WantedInv:

   forall[2] a. blah =&gt; (C alpha[3])
                        (forall[3] b. alpha[3] ~ b)

We can unify alpha:=b in the inner implication, because 'alpha' is
touchable; but then 'b' has excaped its scope into the outer implication.

Note [Skolem escape prevention]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We only unify touchable unification variables.  Because of
(WantedInv), there can be no occurrences of the variable further out,
so the unification can't cause the skolems to escape. Example:
     data T = forall a. MkT a (a-&gt;Int)
     f x (MkT v f) = length [v,x]
We decide (x::alpha), and generate an implication like
      [1]forall a. (a ~ alpha[0])
But we must not unify alpha:=a, because the skolem would escape.

For the cases where we DO want to unify, we rely on floating the
equality.   Example (with same T)
     g x (MkT v f) = x &amp;&amp; True
We decide (x::alpha), and generate an implication like
      [1]forall a. (Bool ~ alpha[0])
We do NOT unify directly, bur rather float out (if the constraint
does not mention 'a') to get
      (Bool ~ alpha[0]) /\ [1]forall a.()
and NOW we can unify alpha.

The same idea of only unifying touchables solves another problem.
Suppose we had
   (F Int ~ uf[0])  /\  [1](forall a. C a =&gt; F Int ~ beta[1])
In this example, beta is touchable inside the implication. The
first solveSimpleWanteds step leaves 'uf' un-unified. Then we move inside
the implication where a new constraint
       uf  ~  beta
emerges. If we (wrongly) spontaneously solved it to get uf := beta,
the whole implication disappears but when we pop out again we are left with
(F Int ~ uf) which will be unified by our final zonking stage and
uf will get unified *once more* to (F Int).

Note [TcLevel assignment]
~~~~~~~~~~~~~~~~~~~~~~~~~
We arrange the TcLevels like this

   0   Top level
   1   First-level implication constraints
   2   Second-level implication constraints
   ...etc...
-}</span><span>
</span><span id="line-665"></span><span>
</span><span id="line-666"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#maxTcLevel"><span class="hs-identifier hs-type">maxTcLevel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span>
</span><span id="line-667"></span><span id="maxTcLevel"><span class="annot"><span class="annottext">maxTcLevel :: TcLevel -&gt; TcLevel -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#maxTcLevel"><span class="hs-identifier hs-var hs-var">maxTcLevel</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span id="local-6989586621680862624"><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862624"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span id="local-6989586621680862623"><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862623"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Arity -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-var">TcLevel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862624"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Arity -&gt; Arity -&gt; Arity
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">`max`</span></span><span> </span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862623"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-668"></span><span>
</span><span id="line-669"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#topTcLevel"><span class="hs-identifier hs-type">topTcLevel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span>
</span><span id="line-670"></span><span class="hs-comment">-- See Note [TcLevel assignment]</span><span>
</span><span id="line-671"></span><span id="topTcLevel"><span class="annot"><span class="annottext">topTcLevel :: TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#topTcLevel"><span class="hs-identifier hs-var hs-var">topTcLevel</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Arity -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-var">TcLevel</span></a></span><span> </span><span class="annot"><span class="annottext">Arity
</span><span class="hs-number">0</span></span><span>   </span><span class="hs-comment">-- 0 = outermost level</span><span>
</span><span id="line-672"></span><span>
</span><span id="line-673"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTopTcLevel"><span class="hs-identifier hs-type">isTopTcLevel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-674"></span><span id="isTopTcLevel"><span class="annot"><span class="annottext">isTopTcLevel :: TcLevel -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isTopTcLevel"><span class="hs-identifier hs-var hs-var">isTopTcLevel</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="annot"><span class="annottext">Arity
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-675"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTopTcLevel"><span class="hs-identifier hs-var">isTopTcLevel</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><span class="hs-identifier">_</span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-676"></span><span>
</span><span id="line-677"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#pushTcLevel"><span class="hs-identifier hs-type">pushTcLevel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span>
</span><span id="line-678"></span><span class="hs-comment">-- See Note [TcLevel assignment]</span><span>
</span><span id="line-679"></span><span id="pushTcLevel"><span class="annot"><span class="annottext">pushTcLevel :: TcLevel -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#pushTcLevel"><span class="hs-identifier hs-var hs-var">pushTcLevel</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span id="local-6989586621680862621"><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862621"><span class="hs-identifier hs-var">us</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Arity -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-var">TcLevel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862621"><span class="hs-identifier hs-var">us</span></a></span><span> </span><span class="annot"><span class="annottext">Arity -&gt; Arity -&gt; Arity
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Arity
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-680"></span><span>
</span><span id="line-681"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#strictlyDeeperThan"><span class="hs-identifier hs-type">strictlyDeeperThan</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-682"></span><span id="strictlyDeeperThan"><span class="annot"><span class="annottext">strictlyDeeperThan :: TcLevel -&gt; TcLevel -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#strictlyDeeperThan"><span class="hs-identifier hs-var hs-var">strictlyDeeperThan</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span id="local-6989586621680862619"><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862619"><span class="hs-identifier hs-var">tv_tclvl</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span id="local-6989586621680862618"><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862618"><span class="hs-identifier hs-var">ctxt_tclvl</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-683"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862619"><span class="hs-identifier hs-var">tv_tclvl</span></a></span><span> </span><span class="annot"><span class="annottext">Arity -&gt; Arity -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862618"><span class="hs-identifier hs-var">ctxt_tclvl</span></a></span><span>
</span><span id="line-684"></span><span>
</span><span id="line-685"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#sameDepthAs"><span class="hs-identifier hs-type">sameDepthAs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-686"></span><span id="sameDepthAs"><span class="annot"><span class="annottext">sameDepthAs :: TcLevel -&gt; TcLevel -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#sameDepthAs"><span class="hs-identifier hs-var hs-var">sameDepthAs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span id="local-6989586621680862616"><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862616"><span class="hs-identifier hs-var">ctxt_tclvl</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span id="local-6989586621680862615"><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862615"><span class="hs-identifier hs-var">tv_tclvl</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-687"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862616"><span class="hs-identifier hs-var">ctxt_tclvl</span></a></span><span> </span><span class="annot"><span class="annottext">Arity -&gt; Arity -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862615"><span class="hs-identifier hs-var">tv_tclvl</span></a></span><span>   </span><span class="hs-comment">-- NB: invariant ctxt_tclvl &gt;= tv_tclvl</span><span>
</span><span id="line-688"></span><span>                             </span><span class="hs-comment">--     So &lt;= would be equivalent</span><span>
</span><span id="line-689"></span><span>
</span><span id="line-690"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#checkTcLevelInvariant"><span class="hs-identifier hs-type">checkTcLevelInvariant</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-691"></span><span class="hs-comment">-- Checks (WantedInv) from Note [TcLevel and untouchable type variables]</span><span>
</span><span id="line-692"></span><span id="checkTcLevelInvariant"><span class="annot"><span class="annottext">checkTcLevelInvariant :: TcLevel -&gt; TcLevel -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#checkTcLevelInvariant"><span class="hs-identifier hs-var hs-var">checkTcLevelInvariant</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span id="local-6989586621680862613"><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862613"><span class="hs-identifier hs-var">ctxt_tclvl</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span id="local-6989586621680862612"><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862612"><span class="hs-identifier hs-var">tv_tclvl</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-693"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862613"><span class="hs-identifier hs-var">ctxt_tclvl</span></a></span><span> </span><span class="annot"><span class="annottext">Arity -&gt; Arity -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862612"><span class="hs-identifier hs-var">tv_tclvl</span></a></span><span>
</span><span id="line-694"></span><span>
</span><span id="line-695"></span><span class="hs-comment">-- Returns topTcLevel for non-TcTyVars</span><span>
</span><span id="line-696"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyVarLevel"><span class="hs-identifier hs-type">tcTyVarLevel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span>
</span><span id="line-697"></span><span id="tcTyVarLevel"><span class="annot"><span class="annottext">tcTyVarLevel :: TcTyVar -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#tcTyVarLevel"><span class="hs-identifier hs-var hs-var">tcTyVarLevel</span></a></span></span><span> </span><span id="local-6989586621680862611"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862611"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-698"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862611"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-699"></span><span>          </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_tclvl :: TcTyVarDetails -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#mtv_tclvl"><span class="hs-identifier hs-var">mtv_tclvl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862609"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862609"><span class="hs-identifier hs-var">tv_lvl</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862609"><span class="hs-identifier hs-var">tv_lvl</span></a></span><span>
</span><span id="line-700"></span><span>          </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SkolemTv"><span class="hs-identifier hs-type">SkolemTv</span></a></span><span> </span><span id="local-6989586621680862608"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862608"><span class="hs-identifier hs-var">tv_lvl</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862608"><span class="hs-identifier hs-var">tv_lvl</span></a></span><span>
</span><span id="line-701"></span><span>          </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><a href="GHC.Tc.Utils.TcType.html#RuntimeUnk"><span class="hs-identifier hs-var">RuntimeUnk</span></a></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#topTcLevel"><span class="hs-identifier hs-var">topTcLevel</span></a></span><span>
</span><span id="line-702"></span><span>
</span><span id="line-703"></span><span>
</span><span id="line-704"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTypeLevel"><span class="hs-identifier hs-type">tcTypeLevel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span>
</span><span id="line-705"></span><span class="hs-comment">-- Max level of any free var of the type</span><span>
</span><span id="line-706"></span><span id="tcTypeLevel"><span class="annot"><span class="annottext">tcTypeLevel :: Type -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#tcTypeLevel"><span class="hs-identifier hs-var hs-var">tcTypeLevel</span></a></span></span><span> </span><span id="local-6989586621680862607"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862607"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-707"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TcTyVar -&gt; TcLevel -&gt; TcLevel) -&gt; TcLevel -&gt; DVarSet -&gt; TcLevel
forall a. (TcTyVar -&gt; a -&gt; a) -&gt; a -&gt; DVarSet -&gt; a
</span><a href="GHC.Types.Var.Set.html#nonDetStrictFoldDVarSet"><span class="hs-identifier hs-var">nonDetStrictFoldDVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcLevel -&gt; TcLevel
</span><a href="#local-6989586621680862605"><span class="hs-identifier hs-var">add</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#topTcLevel"><span class="hs-identifier hs-var">topTcLevel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; DVarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypeDSet"><span class="hs-identifier hs-var">tyCoVarsOfTypeDSet</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862607"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-708"></span><span>    </span><span class="hs-comment">-- It's safe to use a non-deterministic fold because `maxTcLevel` is</span><span>
</span><span id="line-709"></span><span>    </span><span class="hs-comment">-- commutative.</span><span>
</span><span id="line-710"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-711"></span><span>    </span><span id="local-6989586621680862605"><span class="annot"><span class="annottext">add :: TcTyVar -&gt; TcLevel -&gt; TcLevel
</span><a href="#local-6989586621680862605"><span class="hs-identifier hs-var hs-var">add</span></a></span></span><span> </span><span id="local-6989586621680862604"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862604"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span id="local-6989586621680862603"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862603"><span class="hs-identifier hs-var">lvl</span></a></span></span><span>
</span><span id="line-712"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Bool
</span><a href="GHC.Types.Var.html#isTcTyVar"><span class="hs-identifier hs-var">isTcTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862604"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862603"><span class="hs-identifier hs-var">lvl</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; TcLevel -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#maxTcLevel"><span class="hs-operator hs-var">`maxTcLevel`</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#tcTyVarLevel"><span class="hs-identifier hs-var">tcTyVarLevel</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862604"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-713"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862603"><span class="hs-identifier hs-var">lvl</span></a></span><span>
</span><span id="line-714"></span><span>
</span><span id="line-715"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680862599"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-716"></span><span>  </span><span id="local-6989586621680862596"><span class="annot"><span class="annottext">ppr :: TcLevel -&gt; SDoc
</span><a href="#local-6989586621680862596"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span id="local-6989586621680862595"><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862595"><span class="hs-identifier hs-var">us</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Arity -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862595"><span class="hs-identifier hs-var">us</span></a></span><span>
</span><span id="line-717"></span><span>
</span><span id="line-718"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#promoteSkolem"><span class="hs-identifier hs-type">promoteSkolem</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span>
</span><span id="line-719"></span><span id="promoteSkolem"><span class="annot"><span class="annottext">promoteSkolem :: TcLevel -&gt; TcTyVar -&gt; TcTyVar
</span><a href="GHC.Tc.Utils.TcType.html#promoteSkolem"><span class="hs-identifier hs-var hs-var">promoteSkolem</span></a></span></span><span> </span><span id="local-6989586621680862594"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862594"><span class="hs-identifier hs-var">tclvl</span></a></span></span><span> </span><span id="local-6989586621680862593"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862593"><span class="hs-identifier hs-var">skol</span></a></span></span><span>
</span><span id="line-720"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862594"><span class="hs-identifier hs-var">tclvl</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; TcLevel -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#tcTyVarLevel"><span class="hs-identifier hs-var">tcTyVarLevel</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862593"><span class="hs-identifier hs-var">skol</span></a></span><span>
</span><span id="line-721"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isTcTyVar</span><span> </span><span class="hs-identifier">skol</span><span> </span><span class="hs-operator">&amp;&amp;</span><span> </span><span class="hs-identifier">isSkolemTyVar</span><span> </span><span class="hs-identifier">skol</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-722"></span><span>    </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails -&gt; TcTyVar
</span><a href="GHC.Types.Var.html#setTcTyVarDetails"><span class="hs-identifier hs-var">setTcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862593"><span class="hs-identifier hs-var">skol</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcLevel -&gt; Bool -&gt; TcTyVarDetails
</span><a href="GHC.Tc.Utils.TcType.html#SkolemTv"><span class="hs-identifier hs-var">SkolemTv</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862594"><span class="hs-identifier hs-var">tclvl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isOverlappableTyVar"><span class="hs-identifier hs-var">isOverlappableTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862593"><span class="hs-identifier hs-var">skol</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-723"></span><span>
</span><span id="line-724"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-725"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862593"><span class="hs-identifier hs-var">skol</span></a></span><span>
</span><span id="line-726"></span><span>
</span><span id="line-727"></span><span class="hs-comment">-- | Change the TcLevel in a skolem, extending a substitution</span><span>
</span><span id="line-728"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#promoteSkolemX"><span class="hs-identifier hs-type">promoteSkolemX</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#TCvSubst"><span class="hs-identifier hs-type">TCvSubst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#TCvSubst"><span class="hs-identifier hs-type">TCvSubst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-729"></span><span id="promoteSkolemX"><span class="annot"><span class="annottext">promoteSkolemX :: TcLevel -&gt; TCvSubst -&gt; TcTyVar -&gt; (TCvSubst, TcTyVar)
</span><a href="GHC.Tc.Utils.TcType.html#promoteSkolemX"><span class="hs-identifier hs-var hs-var">promoteSkolemX</span></a></span></span><span> </span><span id="local-6989586621680862586"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862586"><span class="hs-identifier hs-var">tclvl</span></a></span></span><span> </span><span id="local-6989586621680862585"><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621680862585"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span id="local-6989586621680862584"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862584"><span class="hs-identifier hs-var">skol</span></a></span></span><span>
</span><span id="line-730"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isTcTyVar</span><span> </span><span class="hs-identifier">skol</span><span> </span><span class="hs-operator">&amp;&amp;</span><span> </span><span class="hs-identifier">isSkolemTyVar</span><span> </span><span class="hs-identifier">skol</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-731"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621680862583"><span class="hs-identifier hs-var">new_subst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862582"><span class="hs-identifier hs-var">new_skol</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-732"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-733"></span><span>    </span><span id="local-6989586621680862582"><span class="annot"><span class="annottext">new_skol :: TcTyVar
</span><a href="#local-6989586621680862582"><span class="hs-identifier hs-var hs-var">new_skol</span></a></span></span><span>
</span><span id="line-734"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862586"><span class="hs-identifier hs-var">tclvl</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; TcLevel -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#tcTyVarLevel"><span class="hs-identifier hs-var">tcTyVarLevel</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862584"><span class="hs-identifier hs-var">skol</span></a></span><span>
</span><span id="line-735"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails -&gt; TcTyVar
</span><a href="GHC.Types.Var.html#setTcTyVarDetails"><span class="hs-identifier hs-var">setTcTyVarDetails</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Type -&gt; Type) -&gt; TcTyVar -&gt; TcTyVar
</span><a href="GHC.Types.Var.html#updateTyVarKind"><span class="hs-identifier hs-var">updateTyVarKind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; Type -&gt; Type
TCvSubst -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Subst.html#substTy"><span class="hs-identifier hs-var">substTy</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621680862585"><span class="hs-identifier hs-var">subst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862584"><span class="hs-identifier hs-var">skol</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-736"></span><span>                          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcLevel -&gt; Bool -&gt; TcTyVarDetails
</span><a href="GHC.Tc.Utils.TcType.html#SkolemTv"><span class="hs-identifier hs-var">SkolemTv</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862586"><span class="hs-identifier hs-var">tclvl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isOverlappableTyVar"><span class="hs-identifier hs-var">isOverlappableTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862584"><span class="hs-identifier hs-var">skol</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-737"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-738"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Type) -&gt; TcTyVar -&gt; TcTyVar
</span><a href="GHC.Types.Var.html#updateTyVarKind"><span class="hs-identifier hs-var">updateTyVarKind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; Type -&gt; Type
TCvSubst -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Subst.html#substTy"><span class="hs-identifier hs-var">substTy</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621680862585"><span class="hs-identifier hs-var">subst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862584"><span class="hs-identifier hs-var">skol</span></a></span><span>
</span><span id="line-739"></span><span>    </span><span id="local-6989586621680862583"><span class="annot"><span class="annottext">new_subst :: TCvSubst
</span><a href="#local-6989586621680862583"><span class="hs-identifier hs-var hs-var">new_subst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TCvSubst -&gt; TcTyVar -&gt; TcTyVar -&gt; TCvSubst
</span><a href="GHC.Core.TyCo.Subst.html#extendTvSubstWithClone"><span class="hs-identifier hs-var">extendTvSubstWithClone</span></a></span><span> </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621680862585"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862584"><span class="hs-identifier hs-var">skol</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862582"><span class="hs-identifier hs-var">new_skol</span></a></span><span>
</span><span id="line-740"></span><span>
</span><span id="line-741"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#promoteSkolemsX"><span class="hs-identifier hs-type">promoteSkolemsX</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#TCvSubst"><span class="hs-identifier hs-type">TCvSubst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#TCvSubst"><span class="hs-identifier hs-type">TCvSubst</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-742"></span><span id="promoteSkolemsX"><span class="annot"><span class="annottext">promoteSkolemsX :: TcLevel -&gt; TCvSubst -&gt; [TcTyVar] -&gt; (TCvSubst, [TcTyVar])
</span><a href="GHC.Tc.Utils.TcType.html#promoteSkolemsX"><span class="hs-identifier hs-var hs-var">promoteSkolemsX</span></a></span></span><span> </span><span id="local-6989586621680862574"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862574"><span class="hs-identifier hs-var">tclvl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TCvSubst -&gt; TcTyVar -&gt; (TCvSubst, TcTyVar))
-&gt; TCvSubst -&gt; [TcTyVar] -&gt; (TCvSubst, [TcTyVar])
forall (t :: * -&gt; *) s a b.
Traversable t =&gt;
(s -&gt; a -&gt; (s, b)) -&gt; s -&gt; t a -&gt; (s, t b)
</span><a href="../../base/src/Data.Traversable.html#mapAccumL"><span class="hs-identifier hs-var">mapAccumL</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcLevel -&gt; TCvSubst -&gt; TcTyVar -&gt; (TCvSubst, TcTyVar)
</span><a href="GHC.Tc.Utils.TcType.html#promoteSkolemX"><span class="hs-identifier hs-var">promoteSkolemX</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862574"><span class="hs-identifier hs-var">tclvl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-743"></span><span>
</span><span id="line-744"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
    Finding type family instances
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-750"></span><span>
</span><span id="line-751"></span><span class="hs-comment">-- | Finds outermost type-family applications occurring in a type,</span><span>
</span><span id="line-752"></span><span class="hs-comment">-- after expanding synonyms.  In the list (F, tys) that is returned</span><span>
</span><span id="line-753"></span><span class="hs-comment">-- we guarantee that tys matches F's arity.  For example, given</span><span>
</span><span id="line-754"></span><span class="hs-comment">--    type family F a :: * -&gt; *    (arity 1)</span><span>
</span><span id="line-755"></span><span class="hs-comment">-- calling tcTyFamInsts on (Maybe (F Int Bool) will return</span><span>
</span><span id="line-756"></span><span class="hs-comment">--     (F, [Int]), not (F, [Int,Bool])</span><span>
</span><span id="line-757"></span><span class="hs-comment">--</span><span>
</span><span id="line-758"></span><span class="hs-comment">-- This is important for its use in deciding termination of type</span><span>
</span><span id="line-759"></span><span class="hs-comment">-- instances (see #11581).  E.g.</span><span>
</span><span id="line-760"></span><span class="hs-comment">--    type instance G [Int] = ...(F Int \&lt;big type&gt;)...</span><span>
</span><span id="line-761"></span><span class="hs-comment">-- we don't need to take \&lt;big type&gt; into account when asking if</span><span>
</span><span id="line-762"></span><span class="hs-comment">-- the calls on the RHS are smaller than the LHS</span><span>
</span><span id="line-763"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyFamInsts"><span class="hs-identifier hs-type">tcTyFamInsts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-764"></span><span id="tcTyFamInsts"><span class="annot"><span class="annottext">tcTyFamInsts :: Type -&gt; [(TyCon, [Type])]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyFamInsts"><span class="hs-identifier hs-var hs-var">tcTyFamInsts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Bool, TyCon, [Type]) -&gt; (TyCon, [Type]))
-&gt; [(Bool, TyCon, [Type])] -&gt; [(TyCon, [Type])]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621680862573"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862573"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680862572"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862572"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862573"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862572"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([(Bool, TyCon, [Type])] -&gt; [(TyCon, [Type])])
-&gt; (Type -&gt; [(Bool, TyCon, [Type])]) -&gt; Type -&gt; [(TyCon, [Type])]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyFamInstsAndVis"><span class="hs-identifier hs-var">tcTyFamInstsAndVis</span></a></span><span>
</span><span id="line-765"></span><span>
</span><span id="line-766"></span><span class="hs-comment">-- | Like 'tcTyFamInsts', except that the output records whether the</span><span>
</span><span id="line-767"></span><span class="hs-comment">-- type family and its arguments occur as an /invisible/ argument in</span><span>
</span><span id="line-768"></span><span class="hs-comment">-- some type application. This information is useful because it helps GHC know</span><span>
</span><span id="line-769"></span><span class="hs-comment">-- when to turn on @-fprint-explicit-kinds@ during error reporting so that</span><span>
</span><span id="line-770"></span><span class="hs-comment">-- users can actually see the type family being mentioned.</span><span>
</span><span id="line-771"></span><span class="hs-comment">--</span><span>
</span><span id="line-772"></span><span class="hs-comment">-- As an example, consider:</span><span>
</span><span id="line-773"></span><span class="hs-comment">--</span><span>
</span><span id="line-774"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-775"></span><span class="hs-comment">-- class C a</span><span>
</span><span id="line-776"></span><span class="hs-comment">-- data T (a :: k)</span><span>
</span><span id="line-777"></span><span class="hs-comment">-- type family F a :: k</span><span>
</span><span id="line-778"></span><span class="hs-comment">-- instance C (T @(F Int) (F Bool))</span><span>
</span><span id="line-779"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-780"></span><span class="hs-comment">--</span><span>
</span><span id="line-781"></span><span class="hs-comment">-- There are two occurrences of the type family `F` in that `C` instance, so</span><span>
</span><span id="line-782"></span><span class="hs-comment">-- @'tcTyFamInstsAndVis' (C (T \@(F Int) (F Bool)))@ will return:</span><span>
</span><span id="line-783"></span><span class="hs-comment">--</span><span>
</span><span id="line-784"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-785"></span><span class="hs-comment">-- [ ('True',  F, [Int])</span><span>
</span><span id="line-786"></span><span class="hs-comment">-- , ('False', F, [Bool]) ]</span><span>
</span><span id="line-787"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-788"></span><span class="hs-comment">--</span><span>
</span><span id="line-789"></span><span class="hs-comment">-- @F Int@ is paired with 'True' since it appears as an /invisible/ argument</span><span>
</span><span id="line-790"></span><span class="hs-comment">-- to @C@, whereas @F Bool@ is paired with 'False' since it appears an a</span><span>
</span><span id="line-791"></span><span class="hs-comment">-- /visible/ argument to @C@.</span><span>
</span><span id="line-792"></span><span class="hs-comment">--</span><span>
</span><span id="line-793"></span><span class="hs-comment">-- See also @Note [Kind arguments in error messages]@ in &quot;GHC.Tc.Errors&quot;.</span><span>
</span><span id="line-794"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyFamInstsAndVis"><span class="hs-identifier hs-type">tcTyFamInstsAndVis</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-795"></span><span id="tcTyFamInstsAndVis"><span class="annot"><span class="annottext">tcTyFamInstsAndVis :: Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyFamInstsAndVis"><span class="hs-identifier hs-var hs-var">tcTyFamInstsAndVis</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyFamInstsAndVisX"><span class="hs-identifier hs-var">tcTyFamInstsAndVisX</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-796"></span><span>
</span><span id="line-797"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyFamInstsAndVisX"><span class="hs-identifier hs-type">tcTyFamInstsAndVisX</span></a></span><span>
</span><span id="line-798"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-comment">-- ^ Is this an invisible argument to some type application?</span><span>
</span><span id="line-799"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-800"></span><span id="tcTyFamInstsAndVisX"><span class="annot"><span class="annottext">tcTyFamInstsAndVisX :: Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyFamInstsAndVisX"><span class="hs-identifier hs-var hs-var">tcTyFamInstsAndVisX</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-801"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-802"></span><span>    </span><span id="local-6989586621680862570"><span class="annot"><span class="annottext">go :: Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="#local-6989586621680862570"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680862568"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862568"><span class="hs-identifier hs-var">is_invis_arg</span></a></span></span><span> </span><span id="local-6989586621680862567"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862567"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-803"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862566"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862566"><span class="hs-identifier hs-var">exp_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862567"><span class="hs-identifier hs-var">ty</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862568"><span class="hs-identifier hs-var">is_invis_arg</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862566"><span class="hs-identifier hs-var">exp_ty</span></a></span><span>
</span><span id="line-804"></span><span>    </span><span class="annot"><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-805"></span><span>    </span><span class="annot"><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862564"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862564"><span class="hs-identifier hs-var">is_invis_arg</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConApp"><span class="hs-identifier hs-type">TyConApp</span></a></span><span> </span><span id="local-6989586621680862562"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862562"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680862561"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862561"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-806"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isTypeFamilyTyCon"><span class="hs-identifier hs-var">isTypeFamilyTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862562"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-807"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862564"><span class="hs-identifier hs-var">is_invis_arg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862562"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Arity -&gt; [Type] -&gt; [Type]
forall a. Arity -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Arity
</span><a href="GHC.Core.TyCon.html#tyConArity"><span class="hs-identifier hs-var hs-var">tyConArity</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862562"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862561"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-808"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-809"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; TyCon -&gt; [Type] -&gt; [(Bool, TyCon, [Type])]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyFamInstsAndVisX"><span class="hs-identifier hs-var">tcTyConAppTyFamInstsAndVisX</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862564"><span class="hs-identifier hs-var">is_invis_arg</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862562"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862561"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-810"></span><span>    </span><span class="annot"><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span>            </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LitTy"><span class="hs-identifier hs-type">LitTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-811"></span><span>    </span><span class="annot"><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862555"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862555"><span class="hs-identifier hs-var">is_invis_arg</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span id="local-6989586621680862553"><span class="annot"><span class="annottext">TyCoVarBinder
</span><a href="#local-6989586621680862553"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621680862552"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862552"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862555"><span class="hs-identifier hs-var">is_invis_arg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVarBinder -&gt; Type
forall argf. VarBndr TcTyVar argf -&gt; Type
</span><a href="GHC.Types.Var.html#binderType"><span class="hs-identifier hs-var">binderType</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVarBinder
</span><a href="#local-6989586621680862553"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-812"></span><span>                                         </span><span class="annot"><span class="annottext">[(Bool, TyCon, [Type])]
-&gt; [(Bool, TyCon, [Type])] -&gt; [(Bool, TyCon, [Type])]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862555"><span class="hs-identifier hs-var">is_invis_arg</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862552"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-813"></span><span>    </span><span class="annot"><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862550"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862550"><span class="hs-identifier hs-var">is_invis_arg</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680862548"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862548"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621680862547"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862547"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680862546"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862546"><span class="hs-identifier hs-var">ty2</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862550"><span class="hs-identifier hs-var">is_invis_arg</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862548"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-814"></span><span>                                         </span><span class="annot"><span class="annottext">[(Bool, TyCon, [Type])]
-&gt; [(Bool, TyCon, [Type])] -&gt; [(Bool, TyCon, [Type])]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862550"><span class="hs-identifier hs-var">is_invis_arg</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862547"><span class="hs-identifier hs-var">ty1</span></a></span><span>
</span><span id="line-815"></span><span>                                         </span><span class="annot"><span class="annottext">[(Bool, TyCon, [Type])]
-&gt; [(Bool, TyCon, [Type])] -&gt; [(Bool, TyCon, [Type])]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862550"><span class="hs-identifier hs-var">is_invis_arg</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862546"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-816"></span><span>    </span><span class="annot"><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862545"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862545"><span class="hs-identifier hs-var">is_invis_arg</span></a></span></span><span> </span><span id="local-6989586621680862544"><span class="annot"><span class="annottext">ty :: Type
</span><a href="#local-6989586621680862544"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppTy"><span class="hs-identifier hs-type">AppTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span>
</span><span id="line-817"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862542"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862542"><span class="hs-identifier hs-var">ty_head</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862541"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862541"><span class="hs-identifier hs-var">ty_args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; (Type, [Type])
</span><a href="GHC.Core.Type.html#splitAppTys"><span class="hs-identifier hs-var">splitAppTys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862544"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-818"></span><span>          </span><span id="local-6989586621680862539"><span class="annot"><span class="annottext">ty_arg_flags :: [ArgFlag]
</span><a href="#local-6989586621680862539"><span class="hs-identifier hs-var hs-var">ty_arg_flags</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; [ArgFlag]
</span><a href="GHC.Core.Type.html#appTyArgFlags"><span class="hs-identifier hs-var">appTyArgFlags</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862542"><span class="hs-identifier hs-var">ty_head</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862541"><span class="hs-identifier hs-var">ty_args</span></a></span><span>
</span><span id="line-819"></span><span>      </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862545"><span class="hs-identifier hs-var">is_invis_arg</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862542"><span class="hs-identifier hs-var">ty_head</span></a></span><span>
</span><span id="line-820"></span><span>         </span><span class="annot"><span class="annottext">[(Bool, TyCon, [Type])]
-&gt; [(Bool, TyCon, [Type])] -&gt; [(Bool, TyCon, [Type])]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[[(Bool, TyCon, [Type])]] -&gt; [(Bool, TyCon, [Type])]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ArgFlag -&gt; Type -&gt; [(Bool, TyCon, [Type])])
-&gt; [ArgFlag] -&gt; [Type] -&gt; [[(Bool, TyCon, [Type])]]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680862535"><span class="annot"><span class="annottext">ArgFlag
</span><a href="#local-6989586621680862535"><span class="hs-identifier hs-var">flag</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgFlag -&gt; Bool
</span><a href="GHC.Types.Var.html#isInvisibleArgFlag"><span class="hs-identifier hs-var">isInvisibleArgFlag</span></a></span><span> </span><span class="annot"><span class="annottext">ArgFlag
</span><a href="#local-6989586621680862535"><span class="hs-identifier hs-var">flag</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-821"></span><span>                            </span><span class="annot"><span class="annottext">[ArgFlag]
</span><a href="#local-6989586621680862539"><span class="hs-identifier hs-var">ty_arg_flags</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862541"><span class="hs-identifier hs-var">ty_args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-822"></span><span>    </span><span class="annot"><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862533"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862533"><span class="hs-identifier hs-var">is_invis_arg</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span> </span><span id="local-6989586621680862531"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862531"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862533"><span class="hs-identifier hs-var">is_invis_arg</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862531"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-823"></span><span>    </span><span class="annot"><a href="#local-6989586621680862570"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span>            </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- don't count tyfams in coercions,</span><span>
</span><span id="line-824"></span><span>                                            </span><span class="hs-comment">-- as they never get normalized,</span><span>
</span><span id="line-825"></span><span>                                            </span><span class="hs-comment">-- anyway</span><span>
</span><span id="line-826"></span><span>
</span><span id="line-827"></span><span class="hs-comment">-- | In an application of a 'TyCon' to some arguments, find the outermost</span><span>
</span><span id="line-828"></span><span class="hs-comment">-- occurrences of type family applications within the arguments. This function</span><span>
</span><span id="line-829"></span><span class="hs-comment">-- will not consider the 'TyCon' itself when checking for type family</span><span>
</span><span id="line-830"></span><span class="hs-comment">-- applications.</span><span>
</span><span id="line-831"></span><span class="hs-comment">--</span><span>
</span><span id="line-832"></span><span class="hs-comment">-- See 'tcTyFamInstsAndVis' for more details on how this works (as this</span><span>
</span><span id="line-833"></span><span class="hs-comment">-- function is called inside of 'tcTyFamInstsAndVis').</span><span>
</span><span id="line-834"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyFamInstsAndVis"><span class="hs-identifier hs-type">tcTyConAppTyFamInstsAndVis</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-835"></span><span id="tcTyConAppTyFamInstsAndVis"><span class="annot"><span class="annottext">tcTyConAppTyFamInstsAndVis :: TyCon -&gt; [Type] -&gt; [(Bool, TyCon, [Type])]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyFamInstsAndVis"><span class="hs-identifier hs-var hs-var">tcTyConAppTyFamInstsAndVis</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; TyCon -&gt; [Type] -&gt; [(Bool, TyCon, [Type])]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyFamInstsAndVisX"><span class="hs-identifier hs-var">tcTyConAppTyFamInstsAndVisX</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-836"></span><span>
</span><span id="line-837"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyFamInstsAndVisX"><span class="hs-identifier hs-type">tcTyConAppTyFamInstsAndVisX</span></a></span><span>
</span><span id="line-838"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-comment">-- ^ Is this an invisible argument to some type application?</span><span>
</span><span id="line-839"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-840"></span><span id="tcTyConAppTyFamInstsAndVisX"><span class="annot"><span class="annottext">tcTyConAppTyFamInstsAndVisX :: Bool -&gt; TyCon -&gt; [Type] -&gt; [(Bool, TyCon, [Type])]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyFamInstsAndVisX"><span class="hs-identifier hs-var hs-var">tcTyConAppTyFamInstsAndVisX</span></a></span></span><span> </span><span id="local-6989586621680862529"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862529"><span class="hs-identifier hs-var">is_invis_arg</span></a></span></span><span> </span><span id="local-6989586621680862528"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862528"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680862527"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862527"><span class="hs-identifier hs-var">tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-841"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862526"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862526"><span class="hs-identifier hs-var">invis_tys</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862525"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862525"><span class="hs-identifier hs-var">vis_tys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; ([Type], [Type])
</span><a href="GHC.Core.Type.html#partitionInvisibleTypes"><span class="hs-identifier hs-var">partitionInvisibleTypes</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862528"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862527"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-842"></span><span>  </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">[[(Bool, TyCon, [Type])]] -&gt; [(Bool, TyCon, [Type])]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">([[(Bool, TyCon, [Type])]] -&gt; [(Bool, TyCon, [Type])])
-&gt; [[(Bool, TyCon, [Type])]] -&gt; [(Bool, TyCon, [Type])]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Type -&gt; [(Bool, TyCon, [Type])])
-&gt; [Type] -&gt; [[(Bool, TyCon, [Type])]]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyFamInstsAndVisX"><span class="hs-identifier hs-var">tcTyFamInstsAndVisX</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span>         </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862526"><span class="hs-identifier hs-var">invis_tys</span></a></span><span>
</span><span id="line-843"></span><span>           </span><span class="annot"><span class="annottext">[[(Bool, TyCon, [Type])]]
-&gt; [[(Bool, TyCon, [Type])]] -&gt; [[(Bool, TyCon, [Type])]]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">(Type -&gt; [(Bool, TyCon, [Type])])
-&gt; [Type] -&gt; [[(Bool, TyCon, [Type])]]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; [(Bool, TyCon, [Type])]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyFamInstsAndVisX"><span class="hs-identifier hs-var">tcTyFamInstsAndVisX</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862529"><span class="hs-identifier hs-var">is_invis_arg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862525"><span class="hs-identifier hs-var">vis_tys</span></a></span><span>
</span><span id="line-844"></span><span>
</span><span id="line-845"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyFamFree"><span class="hs-identifier hs-type">isTyFamFree</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-846"></span><span class="hs-comment">-- ^ Check that a type does not contain any type family applications.</span><span>
</span><span id="line-847"></span><span id="isTyFamFree"><span class="annot"><span class="annottext">isTyFamFree :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isTyFamFree"><span class="hs-identifier hs-var hs-var">isTyFamFree</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(TyCon, [Type])] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">([(TyCon, [Type])] -&gt; Bool)
-&gt; (Type -&gt; [(TyCon, [Type])]) -&gt; Type -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; [(TyCon, [Type])]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyFamInsts"><span class="hs-identifier hs-var">tcTyFamInsts</span></a></span><span>
</span><span id="line-848"></span><span>
</span><span id="line-849"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#anyRewritableTyVar"><span class="hs-identifier hs-type">anyRewritableTyVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>    </span><span class="hs-comment">-- Ignore casts and coercions</span><span>
</span><span id="line-850"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span><span>   </span><span class="hs-comment">-- Ambient role</span><span>
</span><span id="line-851"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span>
</span><span id="line-852"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-853"></span><span class="hs-comment">-- (anyRewritableTyVar ignore_cos pred ty) returns True</span><span>
</span><span id="line-854"></span><span class="hs-comment">--    if the 'pred' returns True of any free TyVar in 'ty'</span><span>
</span><span id="line-855"></span><span class="hs-comment">-- Do not look inside casts and coercions if 'ignore_cos' is True</span><span>
</span><span id="line-856"></span><span class="hs-comment">-- See Note [anyRewritableTyVar must be role-aware]</span><span>
</span><span id="line-857"></span><span id="anyRewritableTyVar"><span class="annot"><span class="annottext">anyRewritableTyVar :: Bool -&gt; EqRel -&gt; (EqRel -&gt; TcTyVar -&gt; Bool) -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#anyRewritableTyVar"><span class="hs-identifier hs-var hs-var">anyRewritableTyVar</span></a></span></span><span> </span><span id="local-6989586621680862522"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862522"><span class="hs-identifier hs-var">ignore_cos</span></a></span></span><span> </span><span id="local-6989586621680862521"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862521"><span class="hs-keyword hs-var">role</span></a></span></span><span> </span><span id="local-6989586621680862520"><span class="annot"><span class="annottext">EqRel -&gt; TcTyVar -&gt; Bool
</span><a href="#local-6989586621680862520"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span id="local-6989586621680862519"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862519"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-858"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862521"><span class="hs-keyword hs-var">role</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="GHC.Types.Var.Set.html#emptyVarSet"><span class="hs-identifier hs-var">emptyVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862519"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-859"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-860"></span><span>    </span><span class="hs-comment">-- NB: No need to expand synonyms, because we can find</span><span>
</span><span id="line-861"></span><span>    </span><span class="hs-comment">-- all free variables of a synonym by looking at its</span><span>
</span><span id="line-862"></span><span>    </span><span class="hs-comment">-- arguments</span><span>
</span><span id="line-863"></span><span>
</span><span id="line-864"></span><span>    </span><span id="local-6989586621680862516"><span class="annot"><span class="annottext">go_tv :: EqRel -&gt; VarSet -&gt; TcTyVar -&gt; Bool
</span><a href="#local-6989586621680862516"><span class="hs-identifier hs-var hs-var">go_tv</span></a></span></span><span> </span><span id="local-6989586621680862515"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862515"><span class="hs-identifier hs-var">rl</span></a></span></span><span> </span><span id="local-6989586621680862514"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862514"><span class="hs-identifier hs-var">bvs</span></a></span></span><span> </span><span id="local-6989586621680862513"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862513"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862513"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; VarSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#elemVarSet"><span class="hs-operator hs-var">`elemVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862514"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-865"></span><span>                    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; TcTyVar -&gt; Bool
</span><a href="#local-6989586621680862520"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862515"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862513"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-866"></span><span>
</span><span id="line-867"></span><span>    </span><span id="local-6989586621680862518"><span class="annot"><span class="annottext">go :: EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680862509"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862509"><span class="hs-identifier hs-var">rl</span></a></span></span><span> </span><span id="local-6989586621680862508"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862508"><span class="hs-identifier hs-var">bvs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span id="local-6989586621680862507"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862507"><span class="hs-identifier hs-var">tv</span></a></span></span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; TcTyVar -&gt; Bool
</span><a href="#local-6989586621680862516"><span class="hs-identifier hs-var">go_tv</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862509"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862508"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862507"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-868"></span><span>    </span><span class="annot"><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><span class="hs-identifier">_</span></span><span>     </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LitTy"><span class="hs-identifier hs-type">LitTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-869"></span><span>    </span><span class="annot"><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862506"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862506"><span class="hs-identifier hs-var">rl</span></a></span></span><span> </span><span id="local-6989586621680862505"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862505"><span class="hs-identifier hs-var">bvs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConApp"><span class="hs-identifier hs-type">TyConApp</span></a></span><span> </span><span id="local-6989586621680862504"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862504"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680862503"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862503"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; TyCon -&gt; [Type] -&gt; Bool
</span><a href="#local-6989586621680862502"><span class="hs-identifier hs-var">go_tc</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862506"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862505"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862504"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862503"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-870"></span><span>    </span><span class="annot"><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862501"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862501"><span class="hs-identifier hs-var">rl</span></a></span></span><span> </span><span id="local-6989586621680862500"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862500"><span class="hs-identifier hs-var">bvs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppTy"><span class="hs-identifier hs-type">AppTy</span></a></span><span> </span><span id="local-6989586621680862499"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862499"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span id="local-6989586621680862498"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862498"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862501"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862500"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862499"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862500"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862498"><span class="hs-identifier hs-var">arg</span></a></span><span>
</span><span id="line-871"></span><span>    </span><span class="annot"><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862495"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862495"><span class="hs-identifier hs-var">rl</span></a></span></span><span> </span><span id="local-6989586621680862494"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862494"><span class="hs-identifier hs-var">bvs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680862493"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862493"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621680862492"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862492"><span class="hs-identifier hs-var">arg</span></a></span></span><span> </span><span id="local-6989586621680862491"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862491"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862494"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862490"><span class="hs-identifier hs-var">arg_rep</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862494"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862489"><span class="hs-identifier hs-var">res_rep</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span>
</span><span id="line-872"></span><span>                                     </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862495"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862494"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862492"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862495"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862494"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862491"><span class="hs-identifier hs-var">res</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862494"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862493"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-873"></span><span>      </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680862490"><span class="annot"><span class="annottext">arg_rep :: Type
</span><a href="#local-6989586621680862490"><span class="hs-identifier hs-var hs-var">arg_rep</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Type
Type -&gt; Type
</span><a href="GHC.Core.Type.html#getRuntimeRep"><span class="hs-identifier hs-var">getRuntimeRep</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862492"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="hs-comment">-- forgetting these causes #17024</span><span>
</span><span id="line-874"></span><span>            </span><span id="local-6989586621680862489"><span class="annot"><span class="annottext">res_rep :: Type
</span><a href="#local-6989586621680862489"><span class="hs-identifier hs-var hs-var">res_rep</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Type
Type -&gt; Type
</span><a href="GHC.Core.Type.html#getRuntimeRep"><span class="hs-identifier hs-var">getRuntimeRep</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862491"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-875"></span><span>    </span><span class="annot"><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862485"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862485"><span class="hs-identifier hs-var">rl</span></a></span></span><span> </span><span id="local-6989586621680862484"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862484"><span class="hs-identifier hs-var">bvs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span id="local-6989586621680862483"><span class="annot"><span class="annottext">TyCoVarBinder
</span><a href="#local-6989586621680862483"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span id="local-6989586621680862482"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862482"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862485"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862484"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet -&gt; TcTyVar -&gt; VarSet
</span><a href="GHC.Types.Var.Set.html#extendVarSet"><span class="hs-operator hs-var">`extendVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVarBinder -&gt; TcTyVar
forall tv argf. VarBndr tv argf -&gt; tv
</span><a href="GHC.Types.Var.html#binderVar"><span class="hs-identifier hs-var">binderVar</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVarBinder
</span><a href="#local-6989586621680862483"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862482"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-876"></span><span>    </span><span class="annot"><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862479"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862479"><span class="hs-identifier hs-var">rl</span></a></span></span><span> </span><span id="local-6989586621680862478"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862478"><span class="hs-identifier hs-var">bvs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span> </span><span id="local-6989586621680862477"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862477"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621680862476"><span class="annot"><span class="annottext">KindCoercion
</span><a href="#local-6989586621680862476"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862479"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862478"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862477"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; KindCoercion -&gt; Bool
</span><a href="#local-6989586621680862475"><span class="hs-identifier hs-var">go_co</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862479"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862478"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><a href="#local-6989586621680862476"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-877"></span><span>    </span><span class="annot"><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862474"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862474"><span class="hs-identifier hs-var">rl</span></a></span></span><span> </span><span id="local-6989586621680862473"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862473"><span class="hs-identifier hs-var">bvs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span id="local-6989586621680862472"><span class="annot"><span class="annottext">KindCoercion
</span><a href="#local-6989586621680862472"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; KindCoercion -&gt; Bool
</span><a href="#local-6989586621680862475"><span class="hs-identifier hs-var">go_co</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862474"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862473"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><a href="#local-6989586621680862472"><span class="hs-identifier hs-var">co</span></a></span><span>  </span><span class="hs-comment">-- ToDo: check</span><span>
</span><span id="line-878"></span><span>
</span><span id="line-879"></span><span>    </span><span id="local-6989586621680862502"><span class="annot"><span class="annottext">go_tc :: EqRel -&gt; VarSet -&gt; TyCon -&gt; [Type] -&gt; Bool
</span><a href="#local-6989586621680862502"><span class="hs-identifier hs-var hs-var">go_tc</span></a></span></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span>  </span><span id="local-6989586621680862471"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862471"><span class="hs-identifier hs-var">bvs</span></a></span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><span class="hs-identifier">_</span></span><span>  </span><span id="local-6989586621680862470"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862470"><span class="hs-identifier hs-var">tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Bool) -&gt; [Type] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862471"><span class="hs-identifier hs-var">bvs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862470"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-880"></span><span>    </span><span class="annot"><a href="#local-6989586621680862502"><span class="hs-identifier hs-var">go_tc</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span> </span><span id="local-6989586621680862467"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862467"><span class="hs-identifier hs-var">bvs</span></a></span></span><span> </span><span id="local-6989586621680862466"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862466"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680862465"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862465"><span class="hs-identifier hs-var">tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Role, Type) -&gt; Bool) -&gt; [(Role, Type)] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">VarSet -&gt; (Role, Type) -&gt; Bool
</span><a href="#local-6989586621680862464"><span class="hs-identifier hs-var">go_arg</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862467"><span class="hs-identifier hs-var">bvs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-881"></span><span>                              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [Role]
</span><a href="GHC.Core.Coercion.html#tyConRolesRepresentational"><span class="hs-identifier hs-var">tyConRolesRepresentational</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862466"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Role] -&gt; [Type] -&gt; [(Role, Type)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-operator hs-var">`zip`</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862465"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-882"></span><span>
</span><span id="line-883"></span><span>    </span><span id="local-6989586621680862464"><span class="annot"><span class="annottext">go_arg :: VarSet -&gt; (Role, Type) -&gt; Bool
</span><a href="#local-6989586621680862464"><span class="hs-identifier hs-var hs-var">go_arg</span></a></span></span><span> </span><span id="local-6989586621680862462"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862462"><span class="hs-identifier hs-var">bvs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span class="hs-special">,</span><span>          </span><span id="local-6989586621680862460"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862460"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span>  </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862462"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862460"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-884"></span><span>    </span><span class="annot"><a href="#local-6989586621680862464"><span class="hs-identifier hs-var">go_arg</span></a></span><span> </span><span id="local-6989586621680862459"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862459"><span class="hs-identifier hs-var">bvs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Representational"><span class="hs-identifier hs-var">Representational</span></a></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862457"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862457"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862518"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862459"><span class="hs-identifier hs-var">bvs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862457"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-885"></span><span>    </span><span class="annot"><a href="#local-6989586621680862464"><span class="hs-identifier hs-var">go_arg</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Phantom"><span class="hs-identifier hs-var">Phantom</span></a></span><span class="hs-special">,</span><span>          </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>  </span><span class="hs-comment">-- We never rewrite with phantoms</span><span>
</span><span id="line-886"></span><span>
</span><span id="line-887"></span><span>    </span><span id="local-6989586621680862475"><span class="annot"><span class="annottext">go_co :: EqRel -&gt; VarSet -&gt; KindCoercion -&gt; Bool
</span><a href="#local-6989586621680862475"><span class="hs-identifier hs-var hs-var">go_co</span></a></span></span><span> </span><span id="local-6989586621680862455"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862455"><span class="hs-identifier hs-var">rl</span></a></span></span><span> </span><span id="local-6989586621680862454"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862454"><span class="hs-identifier hs-var">bvs</span></a></span></span><span> </span><span id="local-6989586621680862453"><span class="annot"><span class="annottext">KindCoercion
</span><a href="#local-6989586621680862453"><span class="hs-identifier hs-var">co</span></a></span></span><span>
</span><span id="line-888"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862522"><span class="hs-identifier hs-var">ignore_cos</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-889"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TcTyVar -&gt; Bool) -&gt; VarSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#anyVarSet"><span class="hs-identifier hs-var">anyVarSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">EqRel -&gt; VarSet -&gt; TcTyVar -&gt; Bool
</span><a href="#local-6989586621680862516"><span class="hs-identifier hs-var">go_tv</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862455"><span class="hs-identifier hs-var">rl</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862454"><span class="hs-identifier hs-var">bvs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">KindCoercion -&gt; VarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfCo"><span class="hs-identifier hs-var">tyCoVarsOfCo</span></a></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><a href="#local-6989586621680862453"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-890"></span><span>      </span><span class="hs-comment">-- We don't have an equivalent of anyRewritableTyVar for coercions</span><span>
</span><span id="line-891"></span><span>      </span><span class="hs-comment">-- (at least not yet) so take the free vars and test them</span><span>
</span><span id="line-892"></span><span>
</span><span id="line-893"></span><span class="hs-comment">{- Note [anyRewritableTyVar must be role-aware]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
anyRewritableTyVar is used during kick-out from the inert set,
to decide if, given a new equality (a ~ ty), we should kick out
a constraint C.  Rather than gather free variables and see if 'a'
is among them, we instead pass in a predicate; this is just efficiency.

Moreover, consider
  work item:   [G] a ~R f b
  inert item:  [G] b ~R f a
We use anyRewritableTyVar to decide whether to kick out the inert item,
on the grounds that the work item might rewrite it. Well, 'a' is certainly
free in [G] b ~R f a.  But because the role of a type variable ('f' in
this case) is nominal, the work item can't actually rewrite the inert item.
Moreover, if we were to kick out the inert item the exact same situation
would re-occur and we end up with an infinite loop in which each kicks
out the other (#14363).
-}</span><span>
</span><span id="line-911"></span><span>
</span><span id="line-912"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
          The &quot;exact&quot; free variables of a type
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-917"></span><span>
</span><span id="line-918"></span><span class="hs-comment">{- Note [Silly type synonym]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
  type T a = Int
What are the free tyvars of (T x)?  Empty, of course!

exactTyCoVarsOfType is used by the type checker to figure out exactly
which type variables are mentioned in a type.  It only matters
occasionally -- see the calls to exactTyCoVarsOfType.

We place this function here in GHC.Tc.Utils.TcType, not in GHC.Core.TyCo.FVs,
because we want to &quot;see&quot; tcView (efficiency issue only).
-}</span><span>
</span><span id="line-931"></span><span>
</span><span id="line-932"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#exactTyCoVarsOfType"><span class="hs-identifier hs-type">exactTyCoVarsOfType</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#TyCoVarSet"><span class="hs-identifier hs-type">TyCoVarSet</span></a></span><span>
</span><span id="line-933"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#exactTyCoVarsOfTypes"><span class="hs-identifier hs-type">exactTyCoVarsOfTypes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#TyCoVarSet"><span class="hs-identifier hs-type">TyCoVarSet</span></a></span><span>
</span><span id="line-934"></span><span class="hs-comment">-- Find the free type variables (of any kind)</span><span>
</span><span id="line-935"></span><span class="hs-comment">-- but *expand* type synonyms.  See Note [Silly type synonym] above.</span><span>
</span><span id="line-936"></span><span>
</span><span id="line-937"></span><span id="exactTyCoVarsOfType"><span class="annot"><span class="annottext">exactTyCoVarsOfType :: Type -&gt; VarSet
</span><a href="GHC.Tc.Utils.TcType.html#exactTyCoVarsOfType"><span class="hs-identifier hs-var hs-var">exactTyCoVarsOfType</span></a></span></span><span>  </span><span id="local-6989586621680862450"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862450"><span class="hs-identifier hs-var">ty</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Endo VarSet -&gt; VarSet
</span><a href="GHC.Core.TyCo.FVs.html#runTyCoVars"><span class="hs-identifier hs-var">runTyCoVars</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; Endo VarSet
</span><a href="GHC.Tc.Utils.TcType.html#exact_ty"><span class="hs-identifier hs-var">exact_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862450"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-938"></span><span id="exactTyCoVarsOfTypes"><span class="annot"><span class="annottext">exactTyCoVarsOfTypes :: [Type] -&gt; VarSet
</span><a href="GHC.Tc.Utils.TcType.html#exactTyCoVarsOfTypes"><span class="hs-identifier hs-var hs-var">exactTyCoVarsOfTypes</span></a></span></span><span> </span><span id="local-6989586621680862447"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862447"><span class="hs-identifier hs-var">tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Endo VarSet -&gt; VarSet
</span><a href="GHC.Core.TyCo.FVs.html#runTyCoVars"><span class="hs-identifier hs-var">runTyCoVars</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Type] -&gt; Endo VarSet
</span><a href="GHC.Tc.Utils.TcType.html#exact_tys"><span class="hs-identifier hs-var">exact_tys</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862447"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-939"></span><span>
</span><span id="line-940"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#exact_ty"><span class="hs-identifier hs-type">exact_ty</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Semigroup.Internal.html#Endo"><span class="hs-identifier hs-type">Endo</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#TyCoVarSet"><span class="hs-identifier hs-type">TyCoVarSet</span></a></span><span>
</span><span id="line-941"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#exact_tys"><span class="hs-identifier hs-type">exact_tys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Semigroup.Internal.html#Endo"><span class="hs-identifier hs-type">Endo</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#TyCoVarSet"><span class="hs-identifier hs-type">TyCoVarSet</span></a></span><span>
</span><span id="line-942"></span><span class="hs-special">(</span><span id="exact_ty"><span class="annot"><span class="annottext">Type -&gt; Endo VarSet
</span><a href="GHC.Tc.Utils.TcType.html#exact_ty"><span class="hs-identifier hs-var">exact_ty</span></a></span></span><span class="hs-special">,</span><span> </span><span id="exact_tys"><span class="annot"><span class="annottext">[Type] -&gt; Endo VarSet
</span><a href="GHC.Tc.Utils.TcType.html#exact_tys"><span class="hs-identifier hs-var">exact_tys</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">KindCoercion -&gt; Endo VarSet
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[KindCoercion] -&gt; Endo VarSet
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoFolder VarSet (Endo VarSet)
-&gt; VarSet
-&gt; (Type -&gt; Endo VarSet, [Type] -&gt; Endo VarSet,
    KindCoercion -&gt; Endo VarSet, [KindCoercion] -&gt; Endo VarSet)
forall a env.
Monoid a =&gt;
TyCoFolder env a
-&gt; env
-&gt; (Type -&gt; a, [Type] -&gt; a, KindCoercion -&gt; a, [KindCoercion] -&gt; a)
</span><a href="GHC.Core.TyCo.Rep.html#foldTyCo"><span class="hs-identifier hs-var">foldTyCo</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoFolder VarSet (Endo VarSet)
</span><a href="GHC.Tc.Utils.TcType.html#exactTcvFolder"><span class="hs-identifier hs-var">exactTcvFolder</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="GHC.Types.Var.Set.html#emptyVarSet"><span class="hs-identifier hs-var">emptyVarSet</span></a></span><span>
</span><span id="line-943"></span><span>
</span><span id="line-944"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#exactTcvFolder"><span class="hs-identifier hs-type">exactTcvFolder</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyCoFolder"><span class="hs-identifier hs-type">TyCoFolder</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#TyCoVarSet"><span class="hs-identifier hs-type">TyCoVarSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Semigroup.Internal.html#Endo"><span class="hs-identifier hs-type">Endo</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#TyCoVarSet"><span class="hs-identifier hs-type">TyCoVarSet</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-945"></span><span id="exactTcvFolder"><span class="annot"><span class="annottext">exactTcvFolder :: TyCoFolder VarSet (Endo VarSet)
</span><a href="GHC.Tc.Utils.TcType.html#exactTcvFolder"><span class="hs-identifier hs-var hs-var">exactTcvFolder</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCoFolder VarSet (Endo VarSet)
</span><a href="GHC.Core.TyCo.FVs.html#deepTcvFolder"><span class="hs-identifier hs-var">deepTcvFolder</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcf_view :: Type -&gt; Maybe Type
</span><a href="GHC.Core.TyCo.Rep.html#tcf_view"><span class="hs-identifier hs-var">tcf_view</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-946"></span><span>                 </span><span class="hs-comment">-- This is the key line</span><span>
</span><span id="line-947"></span><span>
</span><span id="line-948"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                Predicates
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-955"></span><span>
</span><span id="line-956"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcIsTcTyVar"><span class="hs-identifier hs-type">tcIsTcTyVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-957"></span><span class="hs-comment">-- See Note [TcTyVars and TyVars in the typechecker]</span><span>
</span><span id="line-958"></span><span id="tcIsTcTyVar"><span class="annot"><span class="annottext">tcIsTcTyVar :: TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcIsTcTyVar"><span class="hs-identifier hs-var hs-var">tcIsTcTyVar</span></a></span></span><span> </span><span id="local-6989586621680862439"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862439"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Bool
</span><a href="GHC.Types.Var.html#isTyVar"><span class="hs-identifier hs-var">isTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862439"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-959"></span><span>
</span><span id="line-960"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTouchableMetaTyVar"><span class="hs-identifier hs-type">isTouchableMetaTyVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-961"></span><span id="isTouchableMetaTyVar"><span class="annot"><span class="annottext">isTouchableMetaTyVar :: TcLevel -&gt; TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isTouchableMetaTyVar"><span class="hs-identifier hs-var hs-var">isTouchableMetaTyVar</span></a></span></span><span> </span><span id="local-6989586621680862437"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862437"><span class="hs-identifier hs-var">ctxt_tclvl</span></a></span></span><span> </span><span id="local-6989586621680862436"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862436"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-962"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Bool
</span><a href="GHC.Types.Var.html#isTyVar"><span class="hs-identifier hs-var">isTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862436"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-comment">-- See Note [Coercion variables in free variable lists]</span><span>
</span><span id="line-963"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_tclvl :: TcTyVarDetails -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#mtv_tclvl"><span class="hs-identifier hs-var">mtv_tclvl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862435"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862435"><span class="hs-identifier hs-var">tv_tclvl</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mtv_info :: TcTyVarDetails -&gt; MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#mtv_info"><span class="hs-identifier hs-var">mtv_info</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862434"><span class="annot"><span class="annottext">MetaInfo
</span><a href="#local-6989586621680862434"><span class="hs-identifier hs-var">info</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862436"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-964"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MetaInfo -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFlattenInfo"><span class="hs-identifier hs-var">isFlattenInfo</span></a></span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="#local-6989586621680862434"><span class="hs-identifier hs-var">info</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-965"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">checkTcLevelInvariant</span><span> </span><span class="hs-identifier">ctxt_tclvl</span><span> </span><span class="hs-identifier">tv_tclvl</span><span class="hs-special">,</span><span>
</span><span id="line-966"></span><span>             </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">tv</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">tv_tclvl</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">ctxt_tclvl</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-967"></span><span>    </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862435"><span class="hs-identifier hs-var">tv_tclvl</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; TcLevel -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#sameDepthAs"><span class="hs-operator hs-var">`sameDepthAs`</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862437"><span class="hs-identifier hs-var">ctxt_tclvl</span></a></span><span>
</span><span id="line-968"></span><span>
</span><span id="line-969"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-970"></span><span>
</span><span id="line-971"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFloatedTouchableMetaTyVar"><span class="hs-identifier hs-type">isFloatedTouchableMetaTyVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-972"></span><span id="isFloatedTouchableMetaTyVar"><span class="annot"><span class="annottext">isFloatedTouchableMetaTyVar :: TcLevel -&gt; TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFloatedTouchableMetaTyVar"><span class="hs-identifier hs-var hs-var">isFloatedTouchableMetaTyVar</span></a></span></span><span> </span><span id="local-6989586621680862430"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862430"><span class="hs-identifier hs-var">ctxt_tclvl</span></a></span></span><span> </span><span id="local-6989586621680862429"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862429"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-973"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Bool
</span><a href="GHC.Types.Var.html#isTyVar"><span class="hs-identifier hs-var">isTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862429"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-comment">-- See Note [Coercion variables in free variable lists]</span><span>
</span><span id="line-974"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_tclvl :: TcTyVarDetails -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#mtv_tclvl"><span class="hs-identifier hs-var">mtv_tclvl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862428"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862428"><span class="hs-identifier hs-var">tv_tclvl</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mtv_info :: TcTyVarDetails -&gt; MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#mtv_info"><span class="hs-identifier hs-var">mtv_info</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862427"><span class="annot"><span class="annottext">MetaInfo
</span><a href="#local-6989586621680862427"><span class="hs-identifier hs-var">info</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862429"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-975"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MetaInfo -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFlattenInfo"><span class="hs-identifier hs-var">isFlattenInfo</span></a></span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="#local-6989586621680862427"><span class="hs-identifier hs-var">info</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-976"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862428"><span class="hs-identifier hs-var">tv_tclvl</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; TcLevel -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#strictlyDeeperThan"><span class="hs-operator hs-var">`strictlyDeeperThan`</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862430"><span class="hs-identifier hs-var">ctxt_tclvl</span></a></span><span>
</span><span id="line-977"></span><span>
</span><span id="line-978"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-979"></span><span>
</span><span id="line-980"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isImmutableTyVar"><span class="hs-identifier hs-type">isImmutableTyVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-981"></span><span id="isImmutableTyVar"><span class="annot"><span class="annottext">isImmutableTyVar :: TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isImmutableTyVar"><span class="hs-identifier hs-var hs-var">isImmutableTyVar</span></a></span></span><span> </span><span id="local-6989586621680862425"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862425"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isSkolemTyVar"><span class="hs-identifier hs-var">isSkolemTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862425"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-982"></span><span>
</span><span id="line-983"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyConableTyVar"><span class="hs-identifier hs-type">isTyConableTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isSkolemTyVar"><span class="hs-identifier hs-type">isSkolemTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isOverlappableTyVar"><span class="hs-identifier hs-type">isOverlappableTyVar</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-984"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isMetaTyVar"><span class="hs-identifier hs-type">isMetaTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isAmbiguousTyVar"><span class="hs-identifier hs-type">isAmbiguousTyVar</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-985"></span><span>  </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFmvTyVar"><span class="hs-identifier hs-type">isFmvTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFskTyVar"><span class="hs-identifier hs-type">isFskTyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFlattenTyVar"><span class="hs-identifier hs-type">isFlattenTyVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-986"></span><span>
</span><span id="line-987"></span><span id="isTyConableTyVar"><span class="annot"><span class="annottext">isTyConableTyVar :: TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isTyConableTyVar"><span class="hs-identifier hs-var hs-var">isTyConableTyVar</span></a></span></span><span> </span><span id="local-6989586621680862424"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862424"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-988"></span><span>        </span><span class="hs-comment">-- True of a meta-type variable that can be filled in</span><span>
</span><span id="line-989"></span><span>        </span><span class="hs-comment">-- with a type constructor application; in particular,</span><span>
</span><span id="line-990"></span><span>        </span><span class="hs-comment">-- not a TyVarTv</span><span>
</span><span id="line-991"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Bool
</span><a href="GHC.Types.Var.html#isTyVar"><span class="hs-identifier hs-var">isTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862424"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-comment">-- See Note [Coercion variables in free variable lists]</span><span>
</span><span id="line-992"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862424"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-993"></span><span>        </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_info :: TcTyVarDetails -&gt; MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#mtv_info"><span class="hs-identifier hs-var">mtv_info</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#TyVarTv"><span class="hs-identifier hs-var">TyVarTv</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-994"></span><span>        </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><span class="hs-identifier">_</span></span><span>                             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-995"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-996"></span><span>
</span><span id="line-997"></span><span id="isFmvTyVar"><span class="annot"><span class="annottext">isFmvTyVar :: TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFmvTyVar"><span class="hs-identifier hs-var hs-var">isFmvTyVar</span></a></span></span><span> </span><span id="local-6989586621680862423"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862423"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-998"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">tcIsTcTyVar</span><span> </span><span class="hs-identifier">tv</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">tv</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-999"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862423"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1000"></span><span>        </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_info :: TcTyVarDetails -&gt; MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#mtv_info"><span class="hs-identifier hs-var">mtv_info</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#FlatMetaTv"><span class="hs-identifier hs-var">FlatMetaTv</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1001"></span><span>        </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><span class="hs-identifier">_</span></span><span>                                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1002"></span><span>
</span><span id="line-1003"></span><span id="isFskTyVar"><span class="annot"><span class="annottext">isFskTyVar :: TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFskTyVar"><span class="hs-identifier hs-var hs-var">isFskTyVar</span></a></span></span><span> </span><span id="local-6989586621680862422"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862422"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-1004"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">tcIsTcTyVar</span><span> </span><span class="hs-identifier">tv</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">tv</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1005"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862422"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1006"></span><span>        </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_info :: TcTyVarDetails -&gt; MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#mtv_info"><span class="hs-identifier hs-var">mtv_info</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#FlatSkolTv"><span class="hs-identifier hs-var">FlatSkolTv</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1007"></span><span>        </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><span class="hs-identifier">_</span></span><span>                                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1008"></span><span>
</span><span id="line-1009"></span><span class="hs-comment">-- | True of both given and wanted flatten-skolems (fmv and fsk)</span><span>
</span><span id="line-1010"></span><span id="isFlattenTyVar"><span class="annot"><span class="annottext">isFlattenTyVar :: TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFlattenTyVar"><span class="hs-identifier hs-var hs-var">isFlattenTyVar</span></a></span></span><span> </span><span id="local-6989586621680862421"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862421"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-1011"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">tcIsTcTyVar</span><span> </span><span class="hs-identifier">tv</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">tv</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1012"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862421"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1013"></span><span>        </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_info :: TcTyVarDetails -&gt; MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#mtv_info"><span class="hs-identifier hs-var">mtv_info</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862420"><span class="annot"><span class="annottext">MetaInfo
</span><a href="#local-6989586621680862420"><span class="hs-identifier hs-var">info</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MetaInfo -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFlattenInfo"><span class="hs-identifier hs-var">isFlattenInfo</span></a></span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="#local-6989586621680862420"><span class="hs-identifier hs-var">info</span></a></span><span>
</span><span id="line-1014"></span><span>        </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><span class="hs-identifier">_</span></span><span>                          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1015"></span><span>
</span><span id="line-1016"></span><span id="isSkolemTyVar"><span class="annot"><span class="annottext">isSkolemTyVar :: TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isSkolemTyVar"><span class="hs-identifier hs-var hs-var">isSkolemTyVar</span></a></span></span><span> </span><span id="local-6989586621680862419"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862419"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-1017"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">tcIsTcTyVar</span><span> </span><span class="hs-identifier">tv</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">tv</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1018"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862419"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1019"></span><span>        </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1020"></span><span>        </span><span id="local-6989586621680862418"><span class="annot"><span class="annottext">TcTyVarDetails
</span><a href="#local-6989586621680862418"><span class="hs-identifier hs-var">_other</span></a></span></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1021"></span><span>
</span><span id="line-1022"></span><span id="isOverlappableTyVar"><span class="annot"><span class="annottext">isOverlappableTyVar :: TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isOverlappableTyVar"><span class="hs-identifier hs-var hs-var">isOverlappableTyVar</span></a></span></span><span> </span><span id="local-6989586621680862417"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862417"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-1023"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Bool
</span><a href="GHC.Types.Var.html#isTyVar"><span class="hs-identifier hs-var">isTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862417"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-comment">-- See Note [Coercion variables in free variable lists]</span><span>
</span><span id="line-1024"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862417"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1025"></span><span>        </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#SkolemTv"><span class="hs-identifier hs-type">SkolemTv</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680862416"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862416"><span class="hs-identifier hs-var">overlappable</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862416"><span class="hs-identifier hs-var">overlappable</span></a></span><span>
</span><span id="line-1026"></span><span>        </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><span class="hs-identifier">_</span></span><span>                       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1027"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1028"></span><span>
</span><span id="line-1029"></span><span id="isMetaTyVar"><span class="annot"><span class="annottext">isMetaTyVar :: TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isMetaTyVar"><span class="hs-identifier hs-var hs-var">isMetaTyVar</span></a></span></span><span> </span><span id="local-6989586621680862415"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862415"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-1030"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Bool
</span><a href="GHC.Types.Var.html#isTyVar"><span class="hs-identifier hs-var">isTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862415"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-comment">-- See Note [Coercion variables in free variable lists]</span><span>
</span><span id="line-1031"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862415"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1032"></span><span>        </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1033"></span><span>        </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><span class="hs-identifier">_</span></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1034"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1035"></span><span>
</span><span id="line-1036"></span><span class="hs-comment">-- isAmbiguousTyVar is used only when reporting type errors</span><span>
</span><span id="line-1037"></span><span class="hs-comment">-- It picks out variables that are unbound, namely meta</span><span>
</span><span id="line-1038"></span><span class="hs-comment">-- type variables and the RuntimUnk variables created by</span><span>
</span><span id="line-1039"></span><span class="hs-comment">-- GHC.Runtime.Heap.Inspect.zonkRTTIType.  These are &quot;ambiguous&quot; in</span><span>
</span><span id="line-1040"></span><span class="hs-comment">-- the sense that they stand for an as-yet-unknown type</span><span>
</span><span id="line-1041"></span><span id="isAmbiguousTyVar"><span class="annot"><span class="annottext">isAmbiguousTyVar :: TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAmbiguousTyVar"><span class="hs-identifier hs-var hs-var">isAmbiguousTyVar</span></a></span></span><span> </span><span id="local-6989586621680862414"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862414"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-1042"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Bool
</span><a href="GHC.Types.Var.html#isTyVar"><span class="hs-identifier hs-var">isTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862414"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-comment">-- See Note [Coercion variables in free variable lists]</span><span>
</span><span id="line-1043"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862414"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1044"></span><span>        </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1045"></span><span>        </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#RuntimeUnk"><span class="hs-identifier hs-type">RuntimeUnk</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1046"></span><span>        </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1047"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1048"></span><span>
</span><span id="line-1049"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isMetaTyVarTy"><span class="hs-identifier hs-type">isMetaTyVarTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1050"></span><span id="isMetaTyVarTy"><span class="annot"><span class="annottext">isMetaTyVarTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isMetaTyVarTy"><span class="hs-identifier hs-var hs-var">isMetaTyVarTy</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span id="local-6989586621680862413"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862413"><span class="hs-identifier hs-var">tv</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isMetaTyVar"><span class="hs-identifier hs-var">isMetaTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862413"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-1051"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isMetaTyVarTy"><span class="hs-identifier hs-var">isMetaTyVarTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1052"></span><span>
</span><span id="line-1053"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#metaTyVarInfo"><span class="hs-identifier hs-type">metaTyVarInfo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaInfo"><span class="hs-identifier hs-type">MetaInfo</span></a></span><span>
</span><span id="line-1054"></span><span id="metaTyVarInfo"><span class="annot"><span class="annottext">metaTyVarInfo :: TcTyVar -&gt; MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#metaTyVarInfo"><span class="hs-identifier hs-var hs-var">metaTyVarInfo</span></a></span></span><span> </span><span id="local-6989586621680862412"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862412"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-1055"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862412"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1056"></span><span>      </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_info :: TcTyVarDetails -&gt; MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#mtv_info"><span class="hs-identifier hs-var">mtv_info</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862411"><span class="annot"><span class="annottext">MetaInfo
</span><a href="#local-6989586621680862411"><span class="hs-identifier hs-var">info</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="#local-6989586621680862411"><span class="hs-identifier hs-var">info</span></a></span><span>
</span><span id="line-1057"></span><span>      </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; MetaInfo
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;metaTyVarInfo&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862412"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1058"></span><span>
</span><span id="line-1059"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFlattenInfo"><span class="hs-identifier hs-type">isFlattenInfo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaInfo"><span class="hs-identifier hs-type">MetaInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1060"></span><span id="isFlattenInfo"><span class="annot"><span class="annottext">isFlattenInfo :: MetaInfo -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFlattenInfo"><span class="hs-identifier hs-var hs-var">isFlattenInfo</span></a></span></span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#FlatMetaTv"><span class="hs-identifier hs-var">FlatMetaTv</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1061"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFlattenInfo"><span class="hs-identifier hs-var">isFlattenInfo</span></a></span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#FlatSkolTv"><span class="hs-identifier hs-var">FlatSkolTv</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1062"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFlattenInfo"><span class="hs-identifier hs-var">isFlattenInfo</span></a></span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><span class="hs-identifier">_</span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1063"></span><span>
</span><span id="line-1064"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#metaTyVarTcLevel"><span class="hs-identifier hs-type">metaTyVarTcLevel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span>
</span><span id="line-1065"></span><span id="metaTyVarTcLevel"><span class="annot"><span class="annottext">metaTyVarTcLevel :: TcTyVar -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#metaTyVarTcLevel"><span class="hs-identifier hs-var hs-var">metaTyVarTcLevel</span></a></span></span><span> </span><span id="local-6989586621680862409"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862409"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-1066"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862409"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1067"></span><span>      </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_tclvl :: TcTyVarDetails -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#mtv_tclvl"><span class="hs-identifier hs-var">mtv_tclvl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862408"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862408"><span class="hs-identifier hs-var">tclvl</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862408"><span class="hs-identifier hs-var">tclvl</span></a></span><span>
</span><span id="line-1068"></span><span>      </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcLevel
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;metaTyVarTcLevel&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862409"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1069"></span><span>
</span><span id="line-1070"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#metaTyVarTcLevel_maybe"><span class="hs-identifier hs-type">metaTyVarTcLevel_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span>
</span><span id="line-1071"></span><span id="metaTyVarTcLevel_maybe"><span class="annot"><span class="annottext">metaTyVarTcLevel_maybe :: TcTyVar -&gt; Maybe TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#metaTyVarTcLevel_maybe"><span class="hs-identifier hs-var hs-var">metaTyVarTcLevel_maybe</span></a></span></span><span> </span><span id="local-6989586621680862407"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862407"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-1072"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862407"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1073"></span><span>      </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_tclvl :: TcTyVarDetails -&gt; TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#mtv_tclvl"><span class="hs-identifier hs-var">mtv_tclvl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862406"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862406"><span class="hs-identifier hs-var">tclvl</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcLevel -&gt; Maybe TcLevel
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862406"><span class="hs-identifier hs-var">tclvl</span></a></span><span>
</span><span id="line-1074"></span><span>      </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><span class="hs-identifier">_</span></span><span>                            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe TcLevel
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1075"></span><span>
</span><span id="line-1076"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#metaTyVarRef"><span class="hs-identifier hs-type">metaTyVarRef</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IORef.html#IORef"><span class="hs-identifier hs-type">IORef</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaDetails"><span class="hs-identifier hs-type">MetaDetails</span></a></span><span>
</span><span id="line-1077"></span><span id="metaTyVarRef"><span class="annot"><span class="annottext">metaTyVarRef :: TcTyVar -&gt; IORef MetaDetails
</span><a href="GHC.Tc.Utils.TcType.html#metaTyVarRef"><span class="hs-identifier hs-var hs-var">metaTyVarRef</span></a></span></span><span> </span><span id="local-6989586621680862405"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862405"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-1078"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862405"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1079"></span><span>        </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_ref :: TcTyVarDetails -&gt; IORef MetaDetails
</span><a href="GHC.Tc.Utils.TcType.html#mtv_ref"><span class="hs-identifier hs-var">mtv_ref</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862404"><span class="annot"><span class="annottext">IORef MetaDetails
</span><a href="#local-6989586621680862404"><span class="hs-identifier hs-var">ref</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IORef MetaDetails
</span><a href="#local-6989586621680862404"><span class="hs-identifier hs-var">ref</span></a></span><span>
</span><span id="line-1080"></span><span>        </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; IORef MetaDetails
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;metaTyVarRef&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862405"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1081"></span><span>
</span><span id="line-1082"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#setMetaTyVarTcLevel"><span class="hs-identifier hs-type">setMetaTyVarTcLevel</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcLevel"><span class="hs-identifier hs-type">TcLevel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span>
</span><span id="line-1083"></span><span id="setMetaTyVarTcLevel"><span class="annot"><span class="annottext">setMetaTyVarTcLevel :: TcTyVar -&gt; TcLevel -&gt; TcTyVar
</span><a href="GHC.Tc.Utils.TcType.html#setMetaTyVarTcLevel"><span class="hs-identifier hs-var hs-var">setMetaTyVarTcLevel</span></a></span></span><span> </span><span id="local-6989586621680862403"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862403"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span id="local-6989586621680862402"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862402"><span class="hs-identifier hs-var">tclvl</span></a></span></span><span>
</span><span id="line-1084"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862403"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1085"></span><span>      </span><span id="local-6989586621680862401"><span class="annot"><span class="annottext">details :: TcTyVarDetails
</span><a href="#local-6989586621680862401"><span class="hs-identifier hs-var">details</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails -&gt; TcTyVar
</span><a href="GHC.Types.Var.html#setTcTyVarDetails"><span class="hs-identifier hs-var">setTcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862403"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVarDetails
</span><a href="#local-6989586621680862401"><span class="hs-identifier hs-var">details</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_tclvl :: TcLevel
</span><a href="GHC.Tc.Utils.TcType.html#mtv_tclvl"><span class="hs-identifier hs-var">mtv_tclvl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621680862402"><span class="hs-identifier hs-var">tclvl</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1086"></span><span>      </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcTyVar
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;metaTyVarTcLevel&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862403"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1087"></span><span>
</span><span id="line-1088"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyVarTyVar"><span class="hs-identifier hs-type">isTyVarTyVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1089"></span><span id="isTyVarTyVar"><span class="annot"><span class="annottext">isTyVarTyVar :: TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isTyVarTyVar"><span class="hs-identifier hs-var hs-var">isTyVarTyVar</span></a></span></span><span> </span><span id="local-6989586621680862400"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862400"><span class="hs-identifier hs-var">tv</span></a></span></span><span>
</span><span id="line-1090"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862400"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1091"></span><span>        </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaTv"><span class="hs-identifier hs-type">MetaTv</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mtv_info :: TcTyVarDetails -&gt; MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#mtv_info"><span class="hs-identifier hs-var">mtv_info</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MetaInfo
</span><a href="GHC.Tc.Utils.TcType.html#TyVarTv"><span class="hs-identifier hs-var">TyVarTv</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1092"></span><span>        </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><span class="hs-identifier">_</span></span><span>                             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1093"></span><span>
</span><span id="line-1094"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFlexi"><span class="hs-identifier hs-type">isFlexi</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isIndirect"><span class="hs-identifier hs-type">isIndirect</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#MetaDetails"><span class="hs-identifier hs-type">MetaDetails</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1095"></span><span id="isFlexi"><span class="annot"><span class="annottext">isFlexi :: MetaDetails -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFlexi"><span class="hs-identifier hs-var hs-var">isFlexi</span></a></span></span><span> </span><span class="annot"><span class="annottext">MetaDetails
</span><a href="GHC.Tc.Utils.TcType.html#Flexi"><span class="hs-identifier hs-var">Flexi</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1096"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFlexi"><span class="hs-identifier hs-var">isFlexi</span></a></span><span> </span><span class="annot"><span class="annottext">MetaDetails
</span><span class="hs-identifier">_</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1097"></span><span>
</span><span id="line-1098"></span><span id="isIndirect"><span class="annot"><span class="annottext">isIndirect :: MetaDetails -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isIndirect"><span class="hs-identifier hs-var hs-var">isIndirect</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Indirect"><span class="hs-identifier hs-type">Indirect</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1099"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isIndirect"><span class="hs-identifier hs-var">isIndirect</span></a></span><span> </span><span class="annot"><span class="annottext">MetaDetails
</span><span class="hs-identifier">_</span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1100"></span><span>
</span><span id="line-1101"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isRuntimeUnkSkol"><span class="hs-identifier hs-type">isRuntimeUnkSkol</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1102"></span><span class="hs-comment">-- Called only in GHC.Tc.Errors; see Note [Runtime skolems] there</span><span>
</span><span id="line-1103"></span><span id="isRuntimeUnkSkol"><span class="annot"><span class="annottext">isRuntimeUnkSkol :: TcTyVar -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isRuntimeUnkSkol"><span class="hs-identifier hs-var hs-var">isRuntimeUnkSkol</span></a></span></span><span> </span><span id="local-6989586621680862399"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862399"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-1104"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TcTyVarDetails
</span><a href="GHC.Tc.Utils.TcType.html#RuntimeUnk"><span class="hs-identifier hs-var">RuntimeUnk</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVarDetails
</span><a href="GHC.Types.Var.html#tcTyVarDetails"><span class="hs-identifier hs-var">tcTyVarDetails</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862399"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1105"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1106"></span><span>
</span><span id="line-1107"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkTyVarNamePairs"><span class="hs-identifier hs-type">mkTyVarNamePairs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1108"></span><span class="hs-comment">-- Just pair each TyVar with its own name</span><span>
</span><span id="line-1109"></span><span id="mkTyVarNamePairs"><span class="annot"><span class="annottext">mkTyVarNamePairs :: [TcTyVar] -&gt; [(Name, TcTyVar)]
</span><a href="GHC.Tc.Utils.TcType.html#mkTyVarNamePairs"><span class="hs-identifier hs-var hs-var">mkTyVarNamePairs</span></a></span></span><span> </span><span id="local-6989586621680862398"><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862398"><span class="hs-identifier hs-var">tvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar -&gt; Name
</span><a href="GHC.Types.Var.html#tyVarName"><span class="hs-identifier hs-var">tyVarName</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862396"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862396"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621680862396"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862396"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862398"><span class="hs-identifier hs-var">tvs</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1110"></span><span>
</span><span id="line-1111"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#findDupTyVarTvs"><span class="hs-identifier hs-type">findDupTyVarTvs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1112"></span><span class="hs-comment">-- If we have [...(x1,tv)...(x2,tv)...]</span><span>
</span><span id="line-1113"></span><span class="hs-comment">-- return (x1,x2) in the result list</span><span>
</span><span id="line-1114"></span><span id="findDupTyVarTvs"><span class="annot"><span class="annottext">findDupTyVarTvs :: [(Name, TcTyVar)] -&gt; [(Name, Name)]
</span><a href="GHC.Tc.Utils.TcType.html#findDupTyVarTvs"><span class="hs-identifier hs-var hs-var">findDupTyVarTvs</span></a></span></span><span> </span><span id="local-6989586621680862395"><span class="annot"><span class="annottext">[(Name, TcTyVar)]
</span><a href="#local-6989586621680862395"><span class="hs-identifier hs-var">prs</span></a></span></span><span>
</span><span id="line-1115"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(NonEmpty (Name, TcTyVar) -&gt; [(Name, Name)])
-&gt; [NonEmpty (Name, TcTyVar)] -&gt; [(Name, Name)]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">NonEmpty (Name, TcTyVar) -&gt; [(Name, Name)]
forall {b} {b}. NonEmpty (b, b) -&gt; [(b, b)]
</span><a href="#local-6989586621680862393"><span class="hs-identifier hs-var">mk_result_prs</span></a></span><span> </span><span class="annot"><span class="annottext">([NonEmpty (Name, TcTyVar)] -&gt; [(Name, Name)])
-&gt; [NonEmpty (Name, TcTyVar)] -&gt; [(Name, Name)]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1116"></span><span>    </span><span class="annot"><span class="annottext">((Name, TcTyVar) -&gt; (Name, TcTyVar) -&gt; Bool)
-&gt; [(Name, TcTyVar)] -&gt; [NonEmpty (Name, TcTyVar)]
forall a. (a -&gt; a -&gt; Bool) -&gt; [a] -&gt; [NonEmpty a]
</span><a href="GHC.Data.List.SetOps.html#findDupsEq"><span class="hs-identifier hs-var">findDupsEq</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, TcTyVar) -&gt; (Name, TcTyVar) -&gt; Bool
forall {a} {a} {a}. Eq a =&gt; (a, a) -&gt; (a, a) -&gt; Bool
</span><a href="#local-6989586621680862392"><span class="hs-identifier hs-var">eq_snd</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, TcTyVar)]
</span><a href="#local-6989586621680862395"><span class="hs-identifier hs-var">prs</span></a></span><span>
</span><span id="line-1117"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1118"></span><span>    </span><span id="local-6989586621680862392"><span class="annot"><span class="annottext">eq_snd :: (a, a) -&gt; (a, a) -&gt; Bool
</span><a href="#local-6989586621680862392"><span class="hs-identifier hs-var hs-var">eq_snd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621680862389"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680862389"><span class="hs-identifier hs-var">tv1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621680862388"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680862388"><span class="hs-identifier hs-var">tv2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680862389"><span class="hs-identifier hs-var">tv1</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680862388"><span class="hs-identifier hs-var">tv2</span></a></span><span>
</span><span id="line-1119"></span><span>    </span><span id="local-6989586621680862393"><span class="annot"><span class="annottext">mk_result_prs :: NonEmpty (b, b) -&gt; [(b, b)]
</span><a href="#local-6989586621680862393"><span class="hs-identifier hs-var hs-var">mk_result_prs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621680862387"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680862387"><span class="hs-identifier hs-var">n1</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3A%7C"><span class="hs-operator hs-type">:|</span></a></span><span> </span><span id="local-6989586621680862385"><span class="annot"><span class="annottext">[(b, b)]
</span><a href="#local-6989586621680862385"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((b, b) -&gt; (b, b)) -&gt; [(b, b)] -&gt; [(b, b)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621680862384"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680862384"><span class="hs-identifier hs-var">n2</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680862387"><span class="hs-identifier hs-var">n1</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680862384"><span class="hs-identifier hs-var">n2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(b, b)]
</span><a href="#local-6989586621680862385"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1120"></span><span>
</span><span id="line-1121"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
   Tau, sigma and rho
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-1128"></span><span>
</span><span id="line-1129"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkSigmaTy"><span class="hs-identifier hs-type">mkSigmaTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyCoVarBinder"><span class="hs-identifier hs-type">TyCoVarBinder</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-1130"></span><span id="mkSigmaTy"><span class="annot"><span class="annottext">mkSigmaTy :: [TyCoVarBinder] -&gt; [Type] -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#mkSigmaTy"><span class="hs-identifier hs-var hs-var">mkSigmaTy</span></a></span></span><span> </span><span id="local-6989586621680862383"><span class="annot"><span class="annottext">[TyCoVarBinder]
</span><a href="#local-6989586621680862383"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span> </span><span id="local-6989586621680862382"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862382"><span class="hs-identifier hs-var">theta</span></a></span></span><span> </span><span id="local-6989586621680862381"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862381"><span class="hs-identifier hs-var">tau</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyCoVarBinder] -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkForAllTys"><span class="hs-identifier hs-var">mkForAllTys</span></a></span><span> </span><span class="annot"><span class="annottext">[TyCoVarBinder]
</span><a href="#local-6989586621680862383"><span class="hs-identifier hs-var">bndrs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Type] -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#mkPhiTy"><span class="hs-identifier hs-var">mkPhiTy</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862382"><span class="hs-identifier hs-var">theta</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862381"><span class="hs-identifier hs-var">tau</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1131"></span><span>
</span><span id="line-1132"></span><span class="hs-comment">-- | Make a sigma ty where all type variables are 'Inferred'. That is,</span><span>
</span><span id="line-1133"></span><span class="hs-comment">-- they cannot be used with visible type application.</span><span>
</span><span id="line-1134"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkInfSigmaTy"><span class="hs-identifier hs-type">mkInfSigmaTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyCoVar"><span class="hs-identifier hs-type">TyCoVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-1135"></span><span id="mkInfSigmaTy"><span class="annot"><span class="annottext">mkInfSigmaTy :: [TcTyVar] -&gt; [Type] -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#mkInfSigmaTy"><span class="hs-identifier hs-var hs-var">mkInfSigmaTy</span></a></span></span><span> </span><span id="local-6989586621680862379"><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862379"><span class="hs-identifier hs-var">tyvars</span></a></span></span><span> </span><span id="local-6989586621680862378"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862378"><span class="hs-identifier hs-var">theta</span></a></span></span><span> </span><span id="local-6989586621680862377"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862377"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyCoVarBinder] -&gt; [Type] -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#mkSigmaTy"><span class="hs-identifier hs-var">mkSigmaTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgFlag -&gt; [TcTyVar] -&gt; [TyCoVarBinder]
forall vis. vis -&gt; [TcTyVar] -&gt; [VarBndr TcTyVar vis]
</span><a href="GHC.Types.Var.html#mkTyCoVarBinders"><span class="hs-identifier hs-var">mkTyCoVarBinders</span></a></span><span> </span><span class="annot"><span class="annottext">ArgFlag
</span><a href="GHC.Types.Var.html#Inferred"><span class="hs-identifier hs-var">Inferred</span></a></span><span> </span><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862379"><span class="hs-identifier hs-var">tyvars</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862378"><span class="hs-identifier hs-var">theta</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862377"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1136"></span><span>
</span><span id="line-1137"></span><span class="hs-comment">-- | Make a sigma ty where all type variables are &quot;specified&quot;. That is,</span><span>
</span><span id="line-1138"></span><span class="hs-comment">-- they can be used with visible type application</span><span>
</span><span id="line-1139"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkSpecSigmaTy"><span class="hs-identifier hs-type">mkSpecSigmaTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-1140"></span><span id="mkSpecSigmaTy"><span class="annot"><span class="annottext">mkSpecSigmaTy :: [TcTyVar] -&gt; [Type] -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#mkSpecSigmaTy"><span class="hs-identifier hs-var hs-var">mkSpecSigmaTy</span></a></span></span><span> </span><span id="local-6989586621680862374"><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862374"><span class="hs-identifier hs-var">tyvars</span></a></span></span><span> </span><span id="local-6989586621680862373"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862373"><span class="hs-identifier hs-var">preds</span></a></span></span><span> </span><span id="local-6989586621680862372"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862372"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyCoVarBinder] -&gt; [Type] -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#mkSigmaTy"><span class="hs-identifier hs-var">mkSigmaTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgFlag -&gt; [TcTyVar] -&gt; [TyCoVarBinder]
forall vis. vis -&gt; [TcTyVar] -&gt; [VarBndr TcTyVar vis]
</span><a href="GHC.Types.Var.html#mkTyCoVarBinders"><span class="hs-identifier hs-var">mkTyCoVarBinders</span></a></span><span> </span><span class="annot"><span class="annottext">ArgFlag
</span><a href="GHC.Types.Var.html#Specified"><span class="hs-identifier hs-var">Specified</span></a></span><span> </span><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862374"><span class="hs-identifier hs-var">tyvars</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862373"><span class="hs-identifier hs-var">preds</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862372"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1141"></span><span>
</span><span id="line-1142"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkPhiTy"><span class="hs-identifier hs-type">mkPhiTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-1143"></span><span id="mkPhiTy"><span class="annot"><span class="annottext">mkPhiTy :: [Type] -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#mkPhiTy"><span class="hs-identifier hs-var hs-var">mkPhiTy</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkInvisFunTysMany"><span class="hs-identifier hs-var">mkInvisFunTysMany</span></a></span><span>
</span><span id="line-1144"></span><span>
</span><span id="line-1145"></span><span class="hs-comment">---------------</span><span>
</span><span id="line-1146"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-type">getDFunTyKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccName"><span class="hs-identifier hs-type">OccName</span></a></span><span> </span><span class="hs-comment">-- Get some string from a type, to be used to</span><span>
</span><span id="line-1147"></span><span>                                </span><span class="hs-comment">-- construct a dictionary function name</span><span>
</span><span id="line-1148"></span><span id="getDFunTyKey"><span class="annot"><span class="annottext">getDFunTyKey :: Type -&gt; OccName
</span><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-var hs-var">getDFunTyKey</span></a></span></span><span> </span><span id="local-6989586621680862370"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862370"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862369"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862369"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#coreView"><span class="hs-identifier hs-var">coreView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862370"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; OccName
</span><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-var">getDFunTyKey</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862369"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-1149"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-var">getDFunTyKey</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span id="local-6989586621680862368"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862368"><span class="hs-identifier hs-var">tv</span></a></span></span><span class="hs-special">)</span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; OccName
forall a. NamedThing a =&gt; a -&gt; OccName
</span><a href="GHC.Types.Name.html#getOccName"><span class="hs-identifier hs-var">getOccName</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862368"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-1150"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-var">getDFunTyKey</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConApp"><span class="hs-identifier hs-type">TyConApp</span></a></span><span> </span><span id="local-6989586621680862366"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862366"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; OccName
forall a. NamedThing a =&gt; a -&gt; OccName
</span><a href="GHC.Types.Name.html#getOccName"><span class="hs-identifier hs-var">getOccName</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862366"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-1151"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-var">getDFunTyKey</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LitTy"><span class="hs-identifier hs-type">LitTy</span></a></span><span> </span><span id="local-6989586621680862365"><span class="annot"><span class="annottext">TyLit
</span><a href="#local-6989586621680862365"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyLit -&gt; OccName
</span><a href="GHC.Tc.Utils.TcType.html#getDFunTyLitKey"><span class="hs-identifier hs-var">getDFunTyLitKey</span></a></span><span> </span><span class="annot"><span class="annottext">TyLit
</span><a href="#local-6989586621680862365"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1152"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-var">getDFunTyKey</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppTy"><span class="hs-identifier hs-type">AppTy</span></a></span><span> </span><span id="local-6989586621680862363"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862363"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; OccName
</span><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-var">getDFunTyKey</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862363"><span class="hs-identifier hs-var">fun</span></a></span><span>
</span><span id="line-1153"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-var">getDFunTyKey</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; OccName
forall a. NamedThing a =&gt; a -&gt; OccName
</span><a href="GHC.Types.Name.html#getOccName"><span class="hs-identifier hs-var">getOccName</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.Prim.html#funTyCon"><span class="hs-identifier hs-var">funTyCon</span></a></span><span>
</span><span id="line-1154"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-var">getDFunTyKey</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVarBinder
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680862361"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862361"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; OccName
</span><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-var">getDFunTyKey</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862361"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1155"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-var">getDFunTyKey</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span> </span><span id="local-6989586621680862360"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862360"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; OccName
</span><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-var">getDFunTyKey</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862360"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1156"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#getDFunTyKey"><span class="hs-identifier hs-var">getDFunTyKey</span></a></span><span> </span><span id="local-6989586621680862359"><span class="annot"><span class="annottext">t :: Type
</span><a href="#local-6989586621680862359"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; OccName
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;getDFunTyKey&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862359"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1157"></span><span>
</span><span id="line-1158"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#getDFunTyLitKey"><span class="hs-identifier hs-type">getDFunTyLitKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyLit"><span class="hs-identifier hs-type">TyLit</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccName"><span class="hs-identifier hs-type">OccName</span></a></span><span>
</span><span id="line-1159"></span><span id="getDFunTyLitKey"><span class="annot"><span class="annottext">getDFunTyLitKey :: TyLit -&gt; OccName
</span><a href="GHC.Tc.Utils.TcType.html#getDFunTyLitKey"><span class="hs-identifier hs-var hs-var">getDFunTyLitKey</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#NumTyLit"><span class="hs-identifier hs-type">NumTyLit</span></a></span><span> </span><span id="local-6989586621680862357"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680862357"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameSpace -&gt; String -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkOccName"><span class="hs-identifier hs-var">mkOccName</span></a></span><span> </span><span class="annot"><span class="annottext">NameSpace
</span><a href="GHC.Types.Name.Occurrence.html#varName"><span class="hs-identifier hs-var">Name.varName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680862357"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1160"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#getDFunTyLitKey"><span class="hs-identifier hs-var">getDFunTyLitKey</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#StrTyLit"><span class="hs-identifier hs-type">StrTyLit</span></a></span><span> </span><span id="local-6989586621680862352"><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621680862352"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameSpace -&gt; String -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkOccName"><span class="hs-identifier hs-var">mkOccName</span></a></span><span> </span><span class="annot"><span class="annottext">NameSpace
</span><a href="GHC.Types.Name.Occurrence.html#varName"><span class="hs-identifier hs-var">Name.varName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621680862352"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- hm</span><span>
</span><span id="line-1161"></span><span>
</span><span id="line-1162"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
           Building types
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-1167"></span><span>
</span><span id="line-1168"></span><span class="hs-comment">-- ToDo: I think we need Tc versions of these</span><span>
</span><span id="line-1169"></span><span class="hs-comment">-- Reason: mkCastTy checks isReflexiveCastTy, which checks</span><span>
</span><span id="line-1170"></span><span class="hs-comment">--         for equality; and that has a different answer</span><span>
</span><span id="line-1171"></span><span class="hs-comment">--         depending on whether or not Type = Constraint</span><span>
</span><span id="line-1172"></span><span>
</span><span id="line-1173"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkTcAppTys"><span class="hs-identifier hs-type">mkTcAppTys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-1174"></span><span id="mkTcAppTys"><span class="annot"><span class="annottext">mkTcAppTys :: Type -&gt; [Type] -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#mkTcAppTys"><span class="hs-identifier hs-var hs-var">mkTcAppTys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.Type.html#mkAppTys"><span class="hs-identifier hs-var">mkAppTys</span></a></span><span>
</span><span id="line-1175"></span><span>
</span><span id="line-1176"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkTcAppTy"><span class="hs-identifier hs-type">mkTcAppTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-1177"></span><span id="mkTcAppTy"><span class="annot"><span class="annottext">mkTcAppTy :: Type -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#mkTcAppTy"><span class="hs-identifier hs-var hs-var">mkTcAppTy</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Type
</span><a href="GHC.Core.Type.html#mkAppTy"><span class="hs-identifier hs-var">mkAppTy</span></a></span><span>
</span><span id="line-1178"></span><span>
</span><span id="line-1179"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkTcCastTy"><span class="hs-identifier hs-type">mkTcCastTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-1180"></span><span id="mkTcCastTy"><span class="annot"><span class="annottext">mkTcCastTy :: Type -&gt; KindCoercion -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#mkTcCastTy"><span class="hs-identifier hs-var hs-var">mkTcCastTy</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; KindCoercion -&gt; Type
</span><a href="GHC.Core.Type.html#mkCastTy"><span class="hs-identifier hs-var">mkCastTy</span></a></span><span>   </span><span class="hs-comment">-- Do we need a tc version of mkCastTy?</span><span>
</span><span id="line-1181"></span><span>
</span><span id="line-1182"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
   Expanding and splitting
*                                                                      *
************************************************************************

These tcSplit functions are like their non-Tc analogues, but
        *) they do not look through newtypes

However, they are non-monadic and do not follow through mutable type
variables.  It's up to you to make sure this doesn't matter.
-}</span><span>
</span><span id="line-1195"></span><span>
</span><span id="line-1196"></span><span class="hs-comment">-- | Splits a forall type into a list of 'TyBinder's and the inner type.</span><span>
</span><span id="line-1197"></span><span class="hs-comment">-- Always succeeds, even if it returns an empty list.</span><span>
</span><span id="line-1198"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitPiTys"><span class="hs-identifier hs-type">tcSplitPiTys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyBinder"><span class="hs-identifier hs-type">TyBinder</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1199"></span><span id="tcSplitPiTys"><span class="annot"><span class="annottext">tcSplitPiTys :: Type -&gt; ([TyBinder], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitPiTys"><span class="hs-identifier hs-var hs-var">tcSplitPiTys</span></a></span></span><span> </span><span id="local-6989586621680862349"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862349"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1200"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">all</span><span> </span><span class="hs-identifier">isTyBinder</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fst</span><span> </span><span class="hs-identifier">sty</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-identifier">sty</span><span>
</span><span id="line-1201"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680862346"><span class="annot"><span class="annottext">sty :: ([TyBinder], Type)
</span><a href="#local-6989586621680862346"><span class="hs-identifier hs-var hs-var">sty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([TyBinder], Type)
</span><a href="GHC.Core.Type.html#splitPiTys"><span class="hs-identifier hs-var">splitPiTys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862349"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1202"></span><span>
</span><span id="line-1203"></span><span class="hs-comment">-- | Splits a type into a TyBinder and a body, if possible. Panics otherwise</span><span>
</span><span id="line-1204"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitPiTy_maybe"><span class="hs-identifier hs-type">tcSplitPiTy_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyBinder"><span class="hs-identifier hs-type">TyBinder</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1205"></span><span id="tcSplitPiTy_maybe"><span class="annot"><span class="annottext">tcSplitPiTy_maybe :: Type -&gt; Maybe (TyBinder, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitPiTy_maybe"><span class="hs-identifier hs-var hs-var">tcSplitPiTy_maybe</span></a></span></span><span> </span><span id="local-6989586621680862344"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862344"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1206"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isMaybeTyBinder</span><span> </span><span class="hs-identifier">sty</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-identifier">sty</span><span>
</span><span id="line-1207"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1208"></span><span>    </span><span id="local-6989586621680862342"><span class="annot"><span class="annottext">sty :: Maybe (TyBinder, Type)
</span><a href="#local-6989586621680862342"><span class="hs-identifier hs-var hs-var">sty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (TyBinder, Type)
</span><a href="GHC.Core.Type.html#splitPiTy_maybe"><span class="hs-identifier hs-var">splitPiTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862344"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1209"></span><span>    </span><span id="local-6989586621680862343"><span class="annot"><span class="annottext">isMaybeTyBinder :: Maybe (TyBinder, b) -&gt; Bool
</span><a href="#local-6989586621680862343"><span class="hs-identifier hs-var hs-var">isMaybeTyBinder</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862340"><span class="annot"><span class="annottext">TyBinder
</span><a href="#local-6989586621680862340"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyBinder -&gt; Bool
</span><a href="GHC.Core.TyCo.Rep.html#isTyBinder"><span class="hs-identifier hs-var">isTyBinder</span></a></span><span> </span><span class="annot"><span class="annottext">TyBinder
</span><a href="#local-6989586621680862340"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1210"></span><span>    </span><span class="annot"><a href="#local-6989586621680862343"><span class="hs-identifier hs-var">isMaybeTyBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (TyBinder, b)
</span><span class="hs-identifier">_</span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1211"></span><span>
</span><span id="line-1212"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTy_maybe"><span class="hs-identifier hs-type">tcSplitForAllTy_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#TyVarBinder"><span class="hs-identifier hs-type">TyVarBinder</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1213"></span><span id="tcSplitForAllTy_maybe"><span class="annot"><span class="annottext">tcSplitForAllTy_maybe :: Type -&gt; Maybe (TyCoVarBinder, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTy_maybe"><span class="hs-identifier hs-var hs-var">tcSplitForAllTy_maybe</span></a></span></span><span> </span><span id="local-6989586621680862339"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862339"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862338"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862338"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862339"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (TyCoVarBinder, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTy_maybe"><span class="hs-identifier hs-var">tcSplitForAllTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862338"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-1214"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTy_maybe"><span class="hs-identifier hs-var">tcSplitForAllTy_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span id="local-6989586621680862337"><span class="annot"><span class="annottext">TyCoVarBinder
</span><a href="#local-6989586621680862337"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span id="local-6989586621680862336"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862336"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isTyVarBinder</span><span> </span><span class="hs-identifier">tv</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-identifier">Just</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">tv</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ty</span><span class="hs-special">)</span><span>
</span><span id="line-1215"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTy_maybe"><span class="hs-identifier hs-var">tcSplitForAllTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (TyCoVarBinder, Type)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1216"></span><span>
</span><span id="line-1217"></span><span class="hs-comment">-- | Like 'tcSplitPiTys', but splits off only named binders,</span><span>
</span><span id="line-1218"></span><span class="hs-comment">-- returning just the tycovars.</span><span>
</span><span id="line-1219"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTys"><span class="hs-identifier hs-type">tcSplitForAllTys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1220"></span><span id="tcSplitForAllTys"><span class="annot"><span class="annottext">tcSplitForAllTys :: Type -&gt; ([TcTyVar], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTys"><span class="hs-identifier hs-var hs-var">tcSplitForAllTys</span></a></span></span><span> </span><span id="local-6989586621680862334"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862334"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1221"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">all</span><span> </span><span class="hs-identifier">isTyVar</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fst</span><span> </span><span class="hs-identifier">sty</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-identifier">sty</span><span>
</span><span id="line-1222"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680862333"><span class="annot"><span class="annottext">sty :: ([TcTyVar], Type)
</span><a href="#local-6989586621680862333"><span class="hs-identifier hs-var hs-var">sty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([TcTyVar], Type)
</span><a href="GHC.Core.Type.html#splitForAllTys"><span class="hs-identifier hs-var">splitForAllTys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862334"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1223"></span><span>
</span><span id="line-1224"></span><span class="hs-comment">-- | Like 'tcSplitForAllTys', but only splits 'ForAllTy's with 'Required' type</span><span>
</span><span id="line-1225"></span><span class="hs-comment">-- variable binders. All split tyvars are annotated with '()'.</span><span>
</span><span id="line-1226"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTysReq"><span class="hs-identifier hs-type">tcSplitForAllTysReq</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcReqTVBinder"><span class="hs-identifier hs-type">TcReqTVBinder</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1227"></span><span id="tcSplitForAllTysReq"><span class="annot"><span class="annottext">tcSplitForAllTysReq :: Type -&gt; ([TcReqTVBinder], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTysReq"><span class="hs-identifier hs-var hs-var">tcSplitForAllTysReq</span></a></span></span><span> </span><span id="local-6989586621680862331"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862331"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">all</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">isTyVar</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">binderVar</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fst</span><span> </span><span class="hs-identifier">sty</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-identifier">sty</span><span>
</span><span id="line-1228"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680862330"><span class="annot"><span class="annottext">sty :: ([TcReqTVBinder], Type)
</span><a href="#local-6989586621680862330"><span class="hs-identifier hs-var hs-var">sty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([TcReqTVBinder], Type)
</span><a href="GHC.Core.Type.html#splitForAllTysReq"><span class="hs-identifier hs-var">splitForAllTysReq</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862331"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1229"></span><span>
</span><span id="line-1230"></span><span class="hs-comment">-- | Like 'tcSplitForAllTys', but only splits 'ForAllTy's with 'Invisible' type</span><span>
</span><span id="line-1231"></span><span class="hs-comment">-- variable binders. All split tyvars are annotated with their 'Specificity'.</span><span>
</span><span id="line-1232"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTysInvis"><span class="hs-identifier hs-type">tcSplitForAllTysInvis</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcInvisTVBinder"><span class="hs-identifier hs-type">TcInvisTVBinder</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1233"></span><span id="tcSplitForAllTysInvis"><span class="annot"><span class="annottext">tcSplitForAllTysInvis :: Type -&gt; ([TcInvisTVBinder], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTysInvis"><span class="hs-identifier hs-var hs-var">tcSplitForAllTysInvis</span></a></span></span><span> </span><span id="local-6989586621680862328"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862328"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">all</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">isTyVar</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">binderVar</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fst</span><span> </span><span class="hs-identifier">sty</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-identifier">sty</span><span>
</span><span id="line-1234"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680862327"><span class="annot"><span class="annottext">sty :: ([TcInvisTVBinder], Type)
</span><a href="#local-6989586621680862327"><span class="hs-identifier hs-var hs-var">sty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([TcInvisTVBinder], Type)
</span><a href="GHC.Core.Type.html#splitForAllTysInvis"><span class="hs-identifier hs-var">splitForAllTysInvis</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862328"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1235"></span><span>
</span><span id="line-1236"></span><span class="hs-comment">-- | Like 'tcSplitForAllTys', but splits off only named binders.</span><span>
</span><span id="line-1237"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllVarBndrs"><span class="hs-identifier hs-type">tcSplitForAllVarBndrs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVarBinder"><span class="hs-identifier hs-type">TyVarBinder</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1238"></span><span id="tcSplitForAllVarBndrs"><span class="annot"><span class="annottext">tcSplitForAllVarBndrs :: Type -&gt; ([TyCoVarBinder], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllVarBndrs"><span class="hs-identifier hs-var hs-var">tcSplitForAllVarBndrs</span></a></span></span><span> </span><span id="local-6989586621680862325"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862325"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">all</span><span> </span><span class="hs-identifier">isTyVarBinder</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fst</span><span> </span><span class="hs-identifier">sty</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">sty</span><span>
</span><span id="line-1239"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680862324"><span class="annot"><span class="annottext">sty :: ([TyCoVarBinder], Type)
</span><a href="#local-6989586621680862324"><span class="hs-identifier hs-var hs-var">sty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([TyCoVarBinder], Type)
</span><a href="GHC.Core.Type.html#splitForAllVarBndrs"><span class="hs-identifier hs-var">splitForAllVarBndrs</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862325"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1240"></span><span>
</span><span id="line-1241"></span><span class="hs-comment">-- | Is this a ForAllTy with a named binder?</span><span>
</span><span id="line-1242"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcIsForAllTy"><span class="hs-identifier hs-type">tcIsForAllTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1243"></span><span id="tcIsForAllTy"><span class="annot"><span class="annottext">tcIsForAllTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcIsForAllTy"><span class="hs-identifier hs-var hs-var">tcIsForAllTy</span></a></span></span><span> </span><span id="local-6989586621680862322"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862322"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862321"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862321"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862322"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcIsForAllTy"><span class="hs-identifier hs-var">tcIsForAllTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862321"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-1244"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcIsForAllTy"><span class="hs-identifier hs-var">tcIsForAllTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1245"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcIsForAllTy"><span class="hs-identifier hs-var">tcIsForAllTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1246"></span><span>
</span><span id="line-1247"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitPredFunTy_maybe"><span class="hs-identifier hs-type">tcSplitPredFunTy_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1248"></span><span class="hs-comment">-- Split off the first predicate argument from a type</span><span>
</span><span id="line-1249"></span><span id="tcSplitPredFunTy_maybe"><span class="annot"><span class="annottext">tcSplitPredFunTy_maybe :: Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitPredFunTy_maybe"><span class="hs-identifier hs-var hs-var">tcSplitPredFunTy_maybe</span></a></span></span><span> </span><span id="local-6989586621680862320"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862320"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1250"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862319"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862319"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862320"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitPredFunTy_maybe"><span class="hs-identifier hs-var">tcSplitPredFunTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862319"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-1251"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitPredFunTy_maybe"><span class="hs-identifier hs-var">tcSplitPredFunTy_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ft_af :: Type -&gt; AnonArgFlag
</span><a href="GHC.Core.TyCo.Rep.html#ft_af"><span class="hs-identifier hs-var">ft_af</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><a href="GHC.Types.Var.html#InvisArg"><span class="hs-identifier hs-var">InvisArg</span></a></span><span>
</span><span id="line-1252"></span><span>                              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ft_arg :: Type -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#ft_arg"><span class="hs-identifier hs-var">ft_arg</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862315"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862315"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ft_res :: Type -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#ft_res"><span class="hs-identifier hs-var">ft_res</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862313"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862313"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1253"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type, Type) -&gt; Maybe (Type, Type)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862315"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862313"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1254"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitPredFunTy_maybe"><span class="hs-identifier hs-var">tcSplitPredFunTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>
</span><span id="line-1255"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Type, Type)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1256"></span><span>
</span><span id="line-1257"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitPhiTy"><span class="hs-identifier hs-type">tcSplitPhiTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ThetaType"><span class="hs-identifier hs-type">ThetaType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1258"></span><span id="tcSplitPhiTy"><span class="annot"><span class="annottext">tcSplitPhiTy :: Type -&gt; ([Type], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitPhiTy"><span class="hs-identifier hs-var hs-var">tcSplitPhiTy</span></a></span></span><span> </span><span id="local-6989586621680862312"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862312"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1259"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; ([Type], Type)
</span><a href="#local-6989586621680862311"><span class="hs-identifier hs-var">split</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862312"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1260"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1261"></span><span>    </span><span id="local-6989586621680862311"><span class="annot"><span class="annottext">split :: Type -&gt; [Type] -&gt; ([Type], Type)
</span><a href="#local-6989586621680862311"><span class="hs-identifier hs-var hs-var">split</span></a></span></span><span> </span><span id="local-6989586621680862310"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862310"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621680862309"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862309"><span class="hs-identifier hs-var">ts</span></a></span></span><span>
</span><span id="line-1262"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitPredFunTy_maybe"><span class="hs-identifier hs-var">tcSplitPredFunTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862310"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1263"></span><span>          </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862308"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862308"><span class="hs-identifier hs-var">pred</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862307"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862307"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; ([Type], Type)
</span><a href="#local-6989586621680862311"><span class="hs-identifier hs-var">split</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862307"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862308"><span class="hs-identifier hs-var">pred</span></a></span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; [Type]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862309"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1264"></span><span>          </span><span class="annot"><span class="annottext">Maybe (Type, Type)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Type] -&gt; [Type]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862309"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862310"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1265"></span><span>
</span><span id="line-1266"></span><span class="hs-comment">-- | Split a sigma type into its parts.</span><span>
</span><span id="line-1267"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitSigmaTy"><span class="hs-identifier hs-type">tcSplitSigmaTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ThetaType"><span class="hs-identifier hs-type">ThetaType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1268"></span><span id="tcSplitSigmaTy"><span class="annot"><span class="annottext">tcSplitSigmaTy :: Type -&gt; ([TcTyVar], [Type], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitSigmaTy"><span class="hs-identifier hs-var hs-var">tcSplitSigmaTy</span></a></span></span><span> </span><span id="local-6989586621680862305"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862305"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([TcTyVar], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTys"><span class="hs-identifier hs-var">tcSplitForAllTys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862305"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1269"></span><span>                        </span><span class="hs-special">(</span><span id="local-6989586621680862304"><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862304"><span class="hs-identifier hs-var">tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862303"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862303"><span class="hs-identifier hs-var">rho</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([Type], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitPhiTy"><span class="hs-identifier hs-var">tcSplitPhiTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862303"><span class="hs-identifier hs-var">rho</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1270"></span><span>                                        </span><span class="hs-special">(</span><span id="local-6989586621680862302"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862302"><span class="hs-identifier hs-var">theta</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862301"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862301"><span class="hs-identifier hs-var">tau</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862304"><span class="hs-identifier hs-var">tvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862302"><span class="hs-identifier hs-var">theta</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862301"><span class="hs-identifier hs-var">tau</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1271"></span><span>
</span><span id="line-1272"></span><span class="hs-comment">-- | Split a sigma type into its parts, going underneath as many @ForAllTy@s</span><span>
</span><span id="line-1273"></span><span class="hs-comment">-- as possible. For example, given this type synonym:</span><span>
</span><span id="line-1274"></span><span class="hs-comment">--</span><span>
</span><span id="line-1275"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1276"></span><span class="hs-comment">-- type Traversal s t a b = forall f. Applicative f =&gt; (a -&gt; f b) -&gt; s -&gt; f t</span><span>
</span><span id="line-1277"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1278"></span><span class="hs-comment">--</span><span>
</span><span id="line-1279"></span><span class="hs-comment">-- if you called @tcSplitSigmaTy@ on this type:</span><span>
</span><span id="line-1280"></span><span class="hs-comment">--</span><span>
</span><span id="line-1281"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1282"></span><span class="hs-comment">-- forall s t a b. Each s t a b =&gt; Traversal s t a b</span><span>
</span><span id="line-1283"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1284"></span><span class="hs-comment">--</span><span>
</span><span id="line-1285"></span><span class="hs-comment">-- then it would return @([s,t,a,b], [Each s t a b], Traversal s t a b)@. But</span><span>
</span><span id="line-1286"></span><span class="hs-comment">-- if you instead called @tcSplitNestedSigmaTys@ on the type, it would return</span><span>
</span><span id="line-1287"></span><span class="hs-comment">-- @([s,t,a,b,f], [Each s t a b, Applicative f], (a -&gt; f b) -&gt; s -&gt; f t)@.</span><span>
</span><span id="line-1288"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitNestedSigmaTys"><span class="hs-identifier hs-type">tcSplitNestedSigmaTys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ThetaType"><span class="hs-identifier hs-type">ThetaType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1289"></span><span class="hs-comment">-- NB: This is basically a pure version of topInstantiate (from Inst) that</span><span>
</span><span id="line-1290"></span><span class="hs-comment">-- doesn't compute an HsWrapper.</span><span>
</span><span id="line-1291"></span><span id="tcSplitNestedSigmaTys"><span class="annot"><span class="annottext">tcSplitNestedSigmaTys :: Type -&gt; ([TcTyVar], [Type], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitNestedSigmaTys"><span class="hs-identifier hs-var hs-var">tcSplitNestedSigmaTys</span></a></span></span><span> </span><span id="local-6989586621680862300"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862300"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1292"></span><span>    </span><span class="hs-comment">-- If there's a forall, split it apart and try splitting the rho type</span><span>
</span><span id="line-1293"></span><span>    </span><span class="hs-comment">-- underneath it.</span><span>
</span><span id="line-1294"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862299"><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862299"><span class="hs-identifier hs-var">tvs1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862298"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862298"><span class="hs-identifier hs-var">theta1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862297"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862297"><span class="hs-identifier hs-var">rho1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([TcTyVar], [Type], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitSigmaTy"><span class="hs-identifier hs-var">tcSplitSigmaTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862300"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1295"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TcTyVar] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862299"><span class="hs-identifier hs-var">tvs1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862298"><span class="hs-identifier hs-var">theta1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1296"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862296"><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862296"><span class="hs-identifier hs-var">tvs2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862295"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862295"><span class="hs-identifier hs-var">theta2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862294"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862294"><span class="hs-identifier hs-var">rho2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([TcTyVar], [Type], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitNestedSigmaTys"><span class="hs-identifier hs-var">tcSplitNestedSigmaTys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862297"><span class="hs-identifier hs-var">rho1</span></a></span><span>
</span><span id="line-1297"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862299"><span class="hs-identifier hs-var">tvs1</span></a></span><span> </span><span class="annot"><span class="annottext">[TcTyVar] -&gt; [TcTyVar] -&gt; [TcTyVar]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862296"><span class="hs-identifier hs-var">tvs2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862298"><span class="hs-identifier hs-var">theta1</span></a></span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; [Type] -&gt; [Type]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862295"><span class="hs-identifier hs-var">theta2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862294"><span class="hs-identifier hs-var">rho2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1298"></span><span>    </span><span class="hs-comment">-- If there's no forall, we're done.</span><span>
</span><span id="line-1299"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862300"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1300"></span><span>
</span><span id="line-1301"></span><span class="hs-comment">-----------------------</span><span>
</span><span id="line-1302"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyCon"><span class="hs-identifier hs-type">tcTyConAppTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>
</span><span id="line-1303"></span><span id="tcTyConAppTyCon"><span class="annot"><span class="annottext">tcTyConAppTyCon :: Type -&gt; TyCon
</span><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyCon"><span class="hs-identifier hs-var hs-var">tcTyConAppTyCon</span></a></span></span><span> </span><span id="local-6989586621680862293"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862293"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1304"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe TyCon
</span><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyCon_maybe"><span class="hs-identifier hs-var">tcTyConAppTyCon_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862293"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1305"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862292"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862292"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862292"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-1306"></span><span>      </span><span class="annot"><span class="annottext">Maybe TyCon
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TyCon
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcTyConAppTyCon&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprType"><span class="hs-identifier hs-var">pprType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862293"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1307"></span><span>
</span><span id="line-1308"></span><span class="hs-comment">-- | Like 'tcRepSplitTyConApp_maybe', but only returns the 'TyCon'.</span><span>
</span><span id="line-1309"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyCon_maybe"><span class="hs-identifier hs-type">tcTyConAppTyCon_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>
</span><span id="line-1310"></span><span id="tcTyConAppTyCon_maybe"><span class="annot"><span class="annottext">tcTyConAppTyCon_maybe :: Type -&gt; Maybe TyCon
</span><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyCon_maybe"><span class="hs-identifier hs-var hs-var">tcTyConAppTyCon_maybe</span></a></span></span><span> </span><span id="local-6989586621680862291"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862291"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1311"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862290"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862290"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862291"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe TyCon
</span><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyCon_maybe"><span class="hs-identifier hs-var">tcTyConAppTyCon_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862290"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-1312"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyCon_maybe"><span class="hs-identifier hs-var">tcTyConAppTyCon_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConApp"><span class="hs-identifier hs-type">TyConApp</span></a></span><span> </span><span id="local-6989586621680862289"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862289"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-1313"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Maybe TyCon
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862289"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-1314"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyCon_maybe"><span class="hs-identifier hs-var">tcTyConAppTyCon_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ft_af :: Type -&gt; AnonArgFlag
</span><a href="GHC.Core.TyCo.Rep.html#ft_af"><span class="hs-identifier hs-var">ft_af</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><a href="GHC.Types.Var.html#VisArg"><span class="hs-identifier hs-var">VisArg</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1315"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Maybe TyCon
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.Prim.html#funTyCon"><span class="hs-identifier hs-var">funTyCon</span></a></span><span>  </span><span class="hs-comment">-- (=&gt;) is /not/ a TyCon in its own right</span><span>
</span><span id="line-1316"></span><span>                   </span><span class="hs-comment">-- C.f. tcRepSplitAppTy_maybe</span><span>
</span><span id="line-1317"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConAppTyCon_maybe"><span class="hs-identifier hs-var">tcTyConAppTyCon_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>
</span><span id="line-1318"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe TyCon
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1319"></span><span>
</span><span id="line-1320"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConAppArgs"><span class="hs-identifier hs-type">tcTyConAppArgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1321"></span><span id="tcTyConAppArgs"><span class="annot"><span class="annottext">tcTyConAppArgs :: Type -&gt; [Type]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyConAppArgs"><span class="hs-identifier hs-var hs-var">tcTyConAppArgs</span></a></span></span><span> </span><span id="local-6989586621680862287"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862287"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#tcSplitTyConApp_maybe"><span class="hs-identifier hs-var">tcSplitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862287"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1322"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862286"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862286"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862286"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-1323"></span><span>                        </span><span class="annot"><span class="annottext">Maybe (TyCon, [Type])
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; [Type]
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcTyConAppArgs&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprType"><span class="hs-identifier hs-var">pprType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862287"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1324"></span><span>
</span><span id="line-1325"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitTyConApp"><span class="hs-identifier hs-type">tcSplitTyConApp</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1326"></span><span id="tcSplitTyConApp"><span class="annot"><span class="annottext">tcSplitTyConApp :: Type -&gt; (TyCon, [Type])
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitTyConApp"><span class="hs-identifier hs-var hs-var">tcSplitTyConApp</span></a></span></span><span> </span><span id="local-6989586621680862285"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862285"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#tcSplitTyConApp_maybe"><span class="hs-identifier hs-var">tcSplitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862285"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1327"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862284"><span class="annot"><span class="annottext">(TyCon, [Type])
</span><a href="#local-6989586621680862284"><span class="hs-identifier hs-var">stuff</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(TyCon, [Type])
</span><a href="#local-6989586621680862284"><span class="hs-identifier hs-var">stuff</span></a></span><span>
</span><span id="line-1328"></span><span>                        </span><span class="annot"><span class="annottext">Maybe (TyCon, [Type])
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; (TyCon, [Type])
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcSplitTyConApp&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprType"><span class="hs-identifier hs-var">pprType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862285"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1329"></span><span>
</span><span id="line-1330"></span><span class="hs-comment">-----------------------</span><span>
</span><span id="line-1331"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTys"><span class="hs-identifier hs-type">tcSplitFunTys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1332"></span><span id="tcSplitFunTys"><span class="annot"><span class="annottext">tcSplitFunTys :: Type -&gt; ([Scaled Type], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTys"><span class="hs-identifier hs-var hs-var">tcSplitFunTys</span></a></span></span><span> </span><span id="local-6989586621680862283"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862283"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Scaled Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTy_maybe"><span class="hs-identifier hs-var">tcSplitFunTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862283"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1333"></span><span>                        </span><span class="annot"><span class="annottext">Maybe (Scaled Type, Type)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862283"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1334"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862282"><span class="annot"><span class="annottext">Scaled Type
</span><a href="#local-6989586621680862282"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680862281"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862281"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled Type
</span><a href="#local-6989586621680862282"><span class="hs-identifier hs-var">arg</span></a></span><span class="annot"><span class="annottext">Scaled Type -&gt; [Scaled Type] -&gt; [Scaled Type]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621680862280"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862279"><span class="hs-identifier hs-var">res'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1335"></span><span>                                       </span><span class="hs-keyword">where</span><span>
</span><span id="line-1336"></span><span>                                          </span><span class="hs-special">(</span><span id="local-6989586621680862280"><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621680862280"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680862279"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862279"><span class="hs-identifier hs-var">res'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([Scaled Type], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTys"><span class="hs-identifier hs-var">tcSplitFunTys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862281"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1337"></span><span>
</span><span id="line-1338"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTy_maybe"><span class="hs-identifier hs-type">tcSplitFunTy_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1339"></span><span id="tcSplitFunTy_maybe"><span class="annot"><span class="annottext">tcSplitFunTy_maybe :: Type -&gt; Maybe (Scaled Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTy_maybe"><span class="hs-identifier hs-var hs-var">tcSplitFunTy_maybe</span></a></span></span><span> </span><span id="local-6989586621680862278"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862278"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1340"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862277"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862277"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862278"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Scaled Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTy_maybe"><span class="hs-identifier hs-var">tcSplitFunTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862277"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-1341"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTy_maybe"><span class="hs-identifier hs-var">tcSplitFunTy_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ft_af :: Type -&gt; AnonArgFlag
</span><a href="GHC.Core.TyCo.Rep.html#ft_af"><span class="hs-identifier hs-var">ft_af</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862276"><span class="annot"><span class="annottext">AnonArgFlag
</span><a href="#local-6989586621680862276"><span class="hs-identifier hs-var">af</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ft_mult :: Type -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#ft_mult"><span class="hs-identifier hs-var">ft_mult</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862274"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862274"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ft_arg :: Type -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#ft_arg"><span class="hs-identifier hs-var">ft_arg</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862273"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862273"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ft_res :: Type -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#ft_res"><span class="hs-identifier hs-var">ft_res</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680862272"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862272"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1342"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><a href="GHC.Types.Var.html#VisArg"><span class="hs-identifier hs-var">VisArg</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><a href="#local-6989586621680862276"><span class="hs-identifier hs-var">af</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Scaled Type, Type) -&gt; Maybe (Scaled Type, Type)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Scaled Type
forall a. Type -&gt; a -&gt; Scaled a
</span><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-var">Scaled</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862274"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862273"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862272"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1343"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTy_maybe"><span class="hs-identifier hs-var">tcSplitFunTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Scaled Type, Type)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1344"></span><span>        </span><span class="hs-comment">-- Note the VisArg guard</span><span>
</span><span id="line-1345"></span><span>        </span><span class="hs-comment">-- Consider     (?x::Int) =&gt; Bool</span><span>
</span><span id="line-1346"></span><span>        </span><span class="hs-comment">-- We don't want to treat this as a function type!</span><span>
</span><span id="line-1347"></span><span>        </span><span class="hs-comment">-- A concrete example is test tc230:</span><span>
</span><span id="line-1348"></span><span>        </span><span class="hs-comment">--      f :: () -&gt; (?p :: ()) =&gt; () -&gt; ()</span><span>
</span><span id="line-1349"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-1350"></span><span>        </span><span class="hs-comment">--      g = f () ()</span><span>
</span><span id="line-1351"></span><span>
</span><span id="line-1352"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTysN"><span class="hs-identifier hs-type">tcSplitFunTysN</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span>                      </span><span class="hs-comment">-- n: Number of desired args</span><span>
</span><span id="line-1353"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcRhoType"><span class="hs-identifier hs-type">TcRhoType</span></a></span><span>
</span><span id="line-1354"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span>               </span><span class="hs-comment">-- Number of missing arrows</span><span>
</span><span id="line-1355"></span><span>                        </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier hs-type">TcSigmaType</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-comment">-- Arg types (always N types)</span><span>
</span><span id="line-1356"></span><span>                         </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier hs-type">TcSigmaType</span></a></span><span class="hs-special">)</span><span>        </span><span class="hs-comment">-- The rest of the type</span><span>
</span><span id="line-1357"></span><span class="hs-comment">-- ^ Split off exactly the specified number argument types</span><span>
</span><span id="line-1358"></span><span class="hs-comment">-- Returns</span><span>
</span><span id="line-1359"></span><span class="hs-comment">--  (Left m) if there are 'm' missing arrows in the type</span><span>
</span><span id="line-1360"></span><span class="hs-comment">--  (Right (tys,res)) if the type looks like t1 -&gt; ... -&gt; tn -&gt; res</span><span>
</span><span id="line-1361"></span><span id="tcSplitFunTysN"><span class="annot"><span class="annottext">tcSplitFunTysN :: Arity -&gt; Type -&gt; Either Arity ([Scaled Type], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTysN"><span class="hs-identifier hs-var hs-var">tcSplitFunTysN</span></a></span></span><span> </span><span id="local-6989586621680862270"><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862270"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680862269"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862269"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1362"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862270"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Arity -&gt; Arity -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Arity
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1363"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([Scaled Type], Type) -&gt; Either Arity ([Scaled Type], Type)
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862269"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1364"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862268"><span class="annot"><span class="annottext">Scaled Type
</span><a href="#local-6989586621680862268"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680862267"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862267"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Scaled Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTy_maybe"><span class="hs-identifier hs-var">tcSplitFunTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862269"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1365"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Arity -&gt; Type -&gt; Either Arity ([Scaled Type], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTysN"><span class="hs-identifier hs-var">tcSplitFunTysN</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862270"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Arity -&gt; Arity -&gt; Arity
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Arity
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862267"><span class="hs-identifier hs-var">res</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1366"></span><span>     </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621680862266"><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862266"><span class="hs-identifier hs-var">m</span></a></span></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Arity -&gt; Either Arity ([Scaled Type], Type)
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862266"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1367"></span><span>     </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862265"><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621680862265"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680862264"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862264"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">([Scaled Type], Type) -&gt; Either Arity ([Scaled Type], Type)
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Scaled Type
</span><a href="#local-6989586621680862268"><span class="hs-identifier hs-var">arg</span></a></span><span class="annot"><span class="annottext">Scaled Type -&gt; [Scaled Type] -&gt; [Scaled Type]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621680862265"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862264"><span class="hs-identifier hs-var">body</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1368"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1369"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Arity -&gt; Either Arity ([Scaled Type], Type)
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862270"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1370"></span><span>
</span><span id="line-1371"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTy"><span class="hs-identifier hs-type">tcSplitFunTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1372"></span><span id="tcSplitFunTy"><span class="annot"><span class="annottext">tcSplitFunTy :: Type -&gt; (Scaled Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTy"><span class="hs-identifier hs-var hs-var">tcSplitFunTy</span></a></span></span><span>  </span><span id="local-6989586621680862262"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862262"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe (Scaled Type, Type) -&gt; (Scaled Type, Type)
forall a. HasCallStack =&gt; String -&gt; Maybe a -&gt; a
</span><a href="GHC.Data.Maybe.html#expectJust"><span class="hs-identifier hs-var">expectJust</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcSplitFunTy&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; Maybe (Scaled Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTy_maybe"><span class="hs-identifier hs-var">tcSplitFunTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862262"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1373"></span><span>
</span><span id="line-1374"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcFunArgTy"><span class="hs-identifier hs-type">tcFunArgTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Scaled"><span class="hs-identifier hs-type">Scaled</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-1375"></span><span id="tcFunArgTy"><span class="annot"><span class="annottext">tcFunArgTy :: Type -&gt; Scaled Type
</span><a href="GHC.Tc.Utils.TcType.html#tcFunArgTy"><span class="hs-identifier hs-var hs-var">tcFunArgTy</span></a></span></span><span>    </span><span id="local-6989586621680862260"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862260"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Scaled Type, Type) -&gt; Scaled Type
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; (Scaled Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTy"><span class="hs-identifier hs-var">tcSplitFunTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862260"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1376"></span><span>
</span><span id="line-1377"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcFunResultTy"><span class="hs-identifier hs-type">tcFunResultTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-1378"></span><span id="tcFunResultTy"><span class="annot"><span class="annottext">tcFunResultTy :: Type -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#tcFunResultTy"><span class="hs-identifier hs-var hs-var">tcFunResultTy</span></a></span></span><span> </span><span id="local-6989586621680862259"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862259"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Scaled Type, Type) -&gt; Type
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; (Scaled Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTy"><span class="hs-identifier hs-var">tcSplitFunTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862259"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1379"></span><span>
</span><span id="line-1380"></span><span class="hs-comment">-- | Strips off n *visible* arguments and returns the resulting type</span><span>
</span><span id="line-1381"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcFunResultTyN"><span class="hs-identifier hs-type">tcFunResultTyN</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#HasDebugCallStack"><span class="hs-identifier hs-type">HasDebugCallStack</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-1382"></span><span id="tcFunResultTyN"><span class="annot"><span class="annottext">tcFunResultTyN :: HasDebugCallStack =&gt; Arity -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#tcFunResultTyN"><span class="hs-identifier hs-var hs-var">tcFunResultTyN</span></a></span></span><span> </span><span id="local-6989586621680862253"><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862253"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680862252"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862252"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1383"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Scaled Type]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862251"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862251"><span class="hs-identifier hs-var">res_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Arity -&gt; Type -&gt; Either Arity ([Scaled Type], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitFunTysN"><span class="hs-identifier hs-var">tcSplitFunTysN</span></a></span><span> </span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862253"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862252"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1384"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862251"><span class="hs-identifier hs-var">res_ty</span></a></span><span>
</span><span id="line-1385"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1386"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Type
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcFunResultTyN&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Arity -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Arity
</span><a href="#local-6989586621680862253"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862252"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1387"></span><span>
</span><span id="line-1388"></span><span class="hs-comment">-----------------------</span><span>
</span><span id="line-1389"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTy_maybe"><span class="hs-identifier hs-type">tcSplitAppTy_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1390"></span><span id="tcSplitAppTy_maybe"><span class="annot"><span class="annottext">tcSplitAppTy_maybe :: Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTy_maybe"><span class="hs-identifier hs-var hs-var">tcSplitAppTy_maybe</span></a></span></span><span> </span><span id="local-6989586621680862250"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862250"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862249"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862249"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862250"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTy_maybe"><span class="hs-identifier hs-var">tcSplitAppTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862249"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-1391"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTy_maybe"><span class="hs-identifier hs-var">tcSplitAppTy_maybe</span></a></span><span> </span><span id="local-6989586621680862248"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862248"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Core.Type.html#tcRepSplitAppTy_maybe"><span class="hs-identifier hs-var">tcRepSplitAppTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862248"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1392"></span><span>
</span><span id="line-1393"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTy"><span class="hs-identifier hs-type">tcSplitAppTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1394"></span><span id="tcSplitAppTy"><span class="annot"><span class="annottext">tcSplitAppTy :: Type -&gt; (Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTy"><span class="hs-identifier hs-var hs-var">tcSplitAppTy</span></a></span></span><span> </span><span id="local-6989586621680862247"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862247"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTy_maybe"><span class="hs-identifier hs-var">tcSplitAppTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862247"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1395"></span><span>                    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862246"><span class="annot"><span class="annottext">(Type, Type)
</span><a href="#local-6989586621680862246"><span class="hs-identifier hs-var">stuff</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Type, Type)
</span><a href="#local-6989586621680862246"><span class="hs-identifier hs-var">stuff</span></a></span><span>
</span><span id="line-1396"></span><span>                    </span><span class="annot"><span class="annottext">Maybe (Type, Type)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; (Type, Type)
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcSplitAppTy&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprType"><span class="hs-identifier hs-var">pprType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862247"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1397"></span><span>
</span><span id="line-1398"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTys"><span class="hs-identifier hs-type">tcSplitAppTys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1399"></span><span id="tcSplitAppTys"><span class="annot"><span class="annottext">tcSplitAppTys :: Type -&gt; (Type, [Type])
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTys"><span class="hs-identifier hs-var hs-var">tcSplitAppTys</span></a></span></span><span> </span><span id="local-6989586621680862245"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862245"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1400"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; (Type, [Type])
</span><a href="#local-6989586621680862244"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862245"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1401"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1402"></span><span>    </span><span id="local-6989586621680862244"><span class="annot"><span class="annottext">go :: Type -&gt; [Type] -&gt; (Type, [Type])
</span><a href="#local-6989586621680862244"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680862243"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862243"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621680862242"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862242"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTy_maybe"><span class="hs-identifier hs-var">tcSplitAppTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862243"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1403"></span><span>                   </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862241"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862241"><span class="hs-identifier hs-var">ty'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862240"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862240"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; (Type, [Type])
</span><a href="#local-6989586621680862244"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862241"><span class="hs-identifier hs-var">ty'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862240"><span class="hs-identifier hs-var">arg</span></a></span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; [Type]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862242"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1404"></span><span>                   </span><span class="annot"><span class="annottext">Maybe (Type, Type)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862243"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862242"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1405"></span><span>
</span><span id="line-1406"></span><span class="hs-comment">-- | Returns the number of arguments in the given type, without</span><span>
</span><span id="line-1407"></span><span class="hs-comment">-- looking through synonyms. This is used only for error reporting.</span><span>
</span><span id="line-1408"></span><span class="hs-comment">-- We don't look through synonyms because of #11313.</span><span>
</span><span id="line-1409"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcRepGetNumAppTys"><span class="hs-identifier hs-type">tcRepGetNumAppTys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span>
</span><span id="line-1410"></span><span id="tcRepGetNumAppTys"><span class="annot"><span class="annottext">tcRepGetNumAppTys :: Type -&gt; Arity
</span><a href="GHC.Tc.Utils.TcType.html#tcRepGetNumAppTys"><span class="hs-identifier hs-var hs-var">tcRepGetNumAppTys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; Arity
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Arity
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">([Type] -&gt; Arity) -&gt; (Type -&gt; [Type]) -&gt; Type -&gt; Arity
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Type, [Type]) -&gt; [Type]
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">((Type, [Type]) -&gt; [Type])
-&gt; (Type -&gt; (Type, [Type])) -&gt; Type -&gt; [Type]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; (Type, [Type])
Type -&gt; (Type, [Type])
</span><a href="GHC.Core.Type.html#repSplitAppTys"><span class="hs-identifier hs-var">repSplitAppTys</span></a></span><span>
</span><span id="line-1411"></span><span>
</span><span id="line-1412"></span><span class="hs-comment">-----------------------</span><span>
</span><span id="line-1413"></span><span class="hs-comment">-- | If the type is a tyvar, possibly under a cast, returns it, along</span><span>
</span><span id="line-1414"></span><span class="hs-comment">-- with the coercion. Thus, the co is :: kind tv ~N kind type</span><span>
</span><span id="line-1415"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcGetCastedTyVar_maybe"><span class="hs-identifier hs-type">tcGetCastedTyVar_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionN"><span class="hs-identifier hs-type">CoercionN</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1416"></span><span id="tcGetCastedTyVar_maybe"><span class="annot"><span class="annottext">tcGetCastedTyVar_maybe :: Type -&gt; Maybe (TcTyVar, KindCoercion)
</span><a href="GHC.Tc.Utils.TcType.html#tcGetCastedTyVar_maybe"><span class="hs-identifier hs-var hs-var">tcGetCastedTyVar_maybe</span></a></span></span><span> </span><span id="local-6989586621680862236"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862236"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862235"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862235"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862236"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (TcTyVar, KindCoercion)
</span><a href="GHC.Tc.Utils.TcType.html#tcGetCastedTyVar_maybe"><span class="hs-identifier hs-var">tcGetCastedTyVar_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862235"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-1417"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcGetCastedTyVar_maybe"><span class="hs-identifier hs-var">tcGetCastedTyVar_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span id="local-6989586621680862234"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862234"><span class="hs-identifier hs-var">tv</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680862233"><span class="annot"><span class="annottext">KindCoercion
</span><a href="#local-6989586621680862233"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TcTyVar, KindCoercion) -&gt; Maybe (TcTyVar, KindCoercion)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862234"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><a href="#local-6989586621680862233"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1418"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcGetCastedTyVar_maybe"><span class="hs-identifier hs-var">tcGetCastedTyVar_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span id="local-6989586621680862232"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862232"><span class="hs-identifier hs-var">tv</span></a></span></span><span class="hs-special">)</span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TcTyVar, KindCoercion) -&gt; Maybe (TcTyVar, KindCoercion)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862232"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type -&gt; KindCoercion
</span><a href="GHC.Core.Coercion.html#mkNomReflCo"><span class="hs-identifier hs-var">mkNomReflCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar -&gt; Type
</span><a href="GHC.Types.Var.html#tyVarKind"><span class="hs-identifier hs-var">tyVarKind</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862232"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1419"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcGetCastedTyVar_maybe"><span class="hs-identifier hs-var">tcGetCastedTyVar_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>                        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (TcTyVar, KindCoercion)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1420"></span><span>
</span><span id="line-1421"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcGetTyVar_maybe"><span class="hs-identifier hs-type">tcGetTyVar_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span>
</span><span id="line-1422"></span><span id="tcGetTyVar_maybe"><span class="annot"><span class="annottext">tcGetTyVar_maybe :: Type -&gt; Maybe TcTyVar
</span><a href="GHC.Tc.Utils.TcType.html#tcGetTyVar_maybe"><span class="hs-identifier hs-var hs-var">tcGetTyVar_maybe</span></a></span></span><span> </span><span id="local-6989586621680862229"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862229"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862228"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862228"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862229"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe TcTyVar
</span><a href="GHC.Tc.Utils.TcType.html#tcGetTyVar_maybe"><span class="hs-identifier hs-var">tcGetTyVar_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862228"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-1423"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcGetTyVar_maybe"><span class="hs-identifier hs-var">tcGetTyVar_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span id="local-6989586621680862227"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862227"><span class="hs-identifier hs-var">tv</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Maybe TcTyVar
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862227"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-1424"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcGetTyVar_maybe"><span class="hs-identifier hs-var">tcGetTyVar_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe TcTyVar
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1425"></span><span>
</span><span id="line-1426"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcGetTyVar"><span class="hs-identifier hs-type">tcGetTyVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span>
</span><span id="line-1427"></span><span id="tcGetTyVar"><span class="annot"><span class="annottext">tcGetTyVar :: String -&gt; Type -&gt; TcTyVar
</span><a href="GHC.Tc.Utils.TcType.html#tcGetTyVar"><span class="hs-identifier hs-var hs-var">tcGetTyVar</span></a></span></span><span> </span><span id="local-6989586621680862226"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680862226"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span id="local-6989586621680862225"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862225"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1428"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe TcTyVar
</span><a href="GHC.Tc.Utils.TcType.html#tcGetTyVar_maybe"><span class="hs-identifier hs-var">tcGetTyVar_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862225"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1429"></span><span>     </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862224"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862224"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862224"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-1430"></span><span>     </span><span class="annot"><span class="annottext">Maybe TcTyVar
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcTyVar
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680862226"><span class="hs-identifier hs-var">msg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862225"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1431"></span><span>
</span><span id="line-1432"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcIsTyVarTy"><span class="hs-identifier hs-type">tcIsTyVarTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1433"></span><span id="tcIsTyVarTy"><span class="annot"><span class="annottext">tcIsTyVarTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcIsTyVarTy"><span class="hs-identifier hs-var hs-var">tcIsTyVarTy</span></a></span></span><span> </span><span id="local-6989586621680862223"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862223"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862222"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862222"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862223"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcIsTyVarTy"><span class="hs-identifier hs-var">tcIsTyVarTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862222"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-1434"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcIsTyVarTy"><span class="hs-identifier hs-var">tcIsTyVarTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span> </span><span id="local-6989586621680862221"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862221"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcIsTyVarTy"><span class="hs-identifier hs-var">tcIsTyVarTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862221"><span class="hs-identifier hs-var">ty</span></a></span><span>  </span><span class="hs-comment">-- look through casts, as</span><span>
</span><span id="line-1435"></span><span>                                            </span><span class="hs-comment">-- this is only used for</span><span>
</span><span id="line-1436"></span><span>                                            </span><span class="hs-comment">-- e.g., FlexibleContexts</span><span>
</span><span id="line-1437"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcIsTyVarTy"><span class="hs-identifier hs-var">tcIsTyVarTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1438"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcIsTyVarTy"><span class="hs-identifier hs-var">tcIsTyVarTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1439"></span><span>
</span><span id="line-1440"></span><span class="hs-comment">-----------------------</span><span>
</span><span id="line-1441"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitDFunTy"><span class="hs-identifier hs-type">tcSplitDFunTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1442"></span><span class="hs-comment">-- Split the type of a dictionary function</span><span>
</span><span id="line-1443"></span><span class="hs-comment">-- We don't use tcSplitSigmaTy,  because a DFun may (with NDP)</span><span>
</span><span id="line-1444"></span><span class="hs-comment">-- have non-Pred arguments, such as</span><span>
</span><span id="line-1445"></span><span class="hs-comment">--     df :: forall m. (forall b. Eq b =&gt; Eq (m b)) -&gt; C m</span><span>
</span><span id="line-1446"></span><span class="hs-comment">--</span><span>
</span><span id="line-1447"></span><span class="hs-comment">-- Also NB splitFunTys, not tcSplitFunTys;</span><span>
</span><span id="line-1448"></span><span class="hs-comment">-- the latter specifically stops at PredTy arguments,</span><span>
</span><span id="line-1449"></span><span class="hs-comment">-- and we don't want to do that here</span><span>
</span><span id="line-1450"></span><span id="tcSplitDFunTy"><span class="annot"><span class="annottext">tcSplitDFunTy :: Type -&gt; ([TcTyVar], [Type], Class, [Type])
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitDFunTy"><span class="hs-identifier hs-var hs-var">tcSplitDFunTy</span></a></span></span><span> </span><span id="local-6989586621680862220"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862220"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1451"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([TcTyVar], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTys"><span class="hs-identifier hs-var">tcSplitForAllTys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862220"><span class="hs-identifier hs-var">ty</span></a></span><span>   </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862219"><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862219"><span class="hs-identifier hs-var">tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862218"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862218"><span class="hs-identifier hs-var">rho</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1452"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([Scaled Type], Type)
</span><a href="GHC.Core.Type.html#splitFunTys"><span class="hs-identifier hs-var">splitFunTys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862218"><span class="hs-identifier hs-var">rho</span></a></span><span>       </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862216"><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621680862216"><span class="hs-identifier hs-var">theta</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862215"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862215"><span class="hs-identifier hs-var">tau</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1453"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; (Class, [Type])
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitDFunHead"><span class="hs-identifier hs-var">tcSplitDFunHead</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862215"><span class="hs-identifier hs-var">tau</span></a></span><span>   </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862214"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680862214"><span class="hs-identifier hs-var">clas</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862213"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862213"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1454"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862219"><span class="hs-identifier hs-var">tvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(Scaled Type -&gt; Type) -&gt; [Scaled Type] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled Type -&gt; Type
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621680862216"><span class="hs-identifier hs-var">theta</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680862214"><span class="hs-identifier hs-var">clas</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862213"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span class="hs-special">}</span><span class="hs-special">}</span><span>
</span><span id="line-1455"></span><span>
</span><span id="line-1456"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitDFunHead"><span class="hs-identifier hs-type">tcSplitDFunHead</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1457"></span><span id="tcSplitDFunHead"><span class="annot"><span class="annottext">tcSplitDFunHead :: Type -&gt; (Class, [Type])
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitDFunHead"><span class="hs-identifier hs-var hs-var">tcSplitDFunHead</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; (Class, [Type])
Type -&gt; (Class, [Type])
</span><a href="GHC.Core.Predicate.html#getClassPredTys"><span class="hs-identifier hs-var">getClassPredTys</span></a></span><span>
</span><span id="line-1458"></span><span>
</span><span id="line-1459"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitMethodTy"><span class="hs-identifier hs-type">tcSplitMethodTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1460"></span><span class="hs-comment">-- A class method (selector) always has a type like</span><span>
</span><span id="line-1461"></span><span class="hs-comment">--   forall as. C as =&gt; blah</span><span>
</span><span id="line-1462"></span><span class="hs-comment">-- So if the class looks like</span><span>
</span><span id="line-1463"></span><span class="hs-comment">--   class C a where</span><span>
</span><span id="line-1464"></span><span class="hs-comment">--     op :: forall b. (Eq a, Ix b) =&gt; a -&gt; b</span><span>
</span><span id="line-1465"></span><span class="hs-comment">-- the class method type looks like</span><span>
</span><span id="line-1466"></span><span class="hs-comment">--  op :: forall a. C a =&gt; forall b. (Eq a, Ix b) =&gt; a -&gt; b</span><span>
</span><span id="line-1467"></span><span class="hs-comment">--</span><span>
</span><span id="line-1468"></span><span class="hs-comment">-- tcSplitMethodTy just peels off the outer forall and</span><span>
</span><span id="line-1469"></span><span class="hs-comment">-- that first predicate</span><span>
</span><span id="line-1470"></span><span id="tcSplitMethodTy"><span class="annot"><span class="annottext">tcSplitMethodTy :: Type -&gt; ([TcTyVar], Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitMethodTy"><span class="hs-identifier hs-var hs-var">tcSplitMethodTy</span></a></span></span><span> </span><span id="local-6989586621680862210"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862210"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1471"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862209"><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862209"><span class="hs-identifier hs-var">sel_tyvars</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680862208"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862208"><span class="hs-identifier hs-var">sel_rho</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([TcTyVar], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitForAllTys"><span class="hs-identifier hs-var">tcSplitForAllTys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862210"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1472"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862207"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862207"><span class="hs-identifier hs-var">first_pred</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862206"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862206"><span class="hs-identifier hs-var">local_meth_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitPredFunTy_maybe"><span class="hs-identifier hs-var">tcSplitPredFunTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862208"><span class="hs-identifier hs-var">sel_rho</span></a></span><span>
</span><span id="line-1473"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680862209"><span class="hs-identifier hs-var">sel_tyvars</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862207"><span class="hs-identifier hs-var">first_pred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862206"><span class="hs-identifier hs-var">local_meth_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1474"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1475"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; ([TcTyVar], Type, Type)
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcSplitMethodTy&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862210"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1476"></span><span>
</span><span id="line-1477"></span><span>
</span><span id="line-1478"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
            Type equalities
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-1483"></span><span>
</span><span id="line-1484"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcEqKind"><span class="hs-identifier hs-type">tcEqKind</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#HasDebugCallStack"><span class="hs-identifier hs-type">HasDebugCallStack</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcKind"><span class="hs-identifier hs-type">TcKind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcKind"><span class="hs-identifier hs-type">TcKind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1485"></span><span id="tcEqKind"><span class="annot"><span class="annottext">tcEqKind :: HasDebugCallStack =&gt; Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcEqKind"><span class="hs-identifier hs-var hs-var">tcEqKind</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Type -&gt; Bool
Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcEqType"><span class="hs-identifier hs-var">tcEqType</span></a></span><span>
</span><span id="line-1486"></span><span>
</span><span id="line-1487"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcEqType"><span class="hs-identifier hs-type">tcEqType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#HasDebugCallStack"><span class="hs-identifier hs-type">HasDebugCallStack</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1488"></span><span class="hs-comment">-- tcEqType is a proper implements the same Note [Non-trivial definitional</span><span>
</span><span id="line-1489"></span><span class="hs-comment">-- equality] (in GHC.Core.TyCo.Rep) as `eqType`, but Type.eqType believes (* ==</span><span>
</span><span id="line-1490"></span><span class="hs-comment">-- Constraint), and that is NOT what we want in the type checker!</span><span>
</span><span id="line-1491"></span><span id="tcEqType"><span class="annot"><span class="annottext">tcEqType :: HasDebugCallStack =&gt; Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcEqType"><span class="hs-identifier hs-var hs-var">tcEqType</span></a></span></span><span> </span><span id="local-6989586621680862202"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862202"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680862201"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862201"><span class="hs-identifier hs-var">ty2</span></a></span></span><span>
</span><span id="line-1492"></span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tc_eq_type"><span class="hs-identifier hs-var">tc_eq_type</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862199"><span class="hs-identifier hs-var">ki1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862198"><span class="hs-identifier hs-var">ki2</span></a></span><span>
</span><span id="line-1493"></span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tc_eq_type"><span class="hs-identifier hs-var">tc_eq_type</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862202"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862201"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1494"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1495"></span><span>    </span><span id="local-6989586621680862199"><span class="annot"><span class="annottext">ki1 :: Type
</span><a href="#local-6989586621680862199"><span class="hs-identifier hs-var hs-var">ki1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Type
Type -&gt; Type
</span><a href="GHC.Core.Type.html#tcTypeKind"><span class="hs-identifier hs-var">tcTypeKind</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862202"><span class="hs-identifier hs-var">ty1</span></a></span><span>
</span><span id="line-1496"></span><span>    </span><span id="local-6989586621680862198"><span class="annot"><span class="annottext">ki2 :: Type
</span><a href="#local-6989586621680862198"><span class="hs-identifier hs-var hs-var">ki2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Type
Type -&gt; Type
</span><a href="GHC.Core.Type.html#tcTypeKind"><span class="hs-identifier hs-var">tcTypeKind</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862201"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1497"></span><span>
</span><span id="line-1498"></span><span class="hs-comment">-- | Just like 'tcEqType', but will return True for types of different kinds</span><span>
</span><span id="line-1499"></span><span class="hs-comment">-- as long as their non-coercion structure is identical.</span><span>
</span><span id="line-1500"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcEqTypeNoKindCheck"><span class="hs-identifier hs-type">tcEqTypeNoKindCheck</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1501"></span><span id="tcEqTypeNoKindCheck"><span class="annot"><span class="annottext">tcEqTypeNoKindCheck :: Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcEqTypeNoKindCheck"><span class="hs-identifier hs-var hs-var">tcEqTypeNoKindCheck</span></a></span></span><span> </span><span id="local-6989586621680862195"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862195"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680862194"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862194"><span class="hs-identifier hs-var">ty2</span></a></span></span><span>
</span><span id="line-1502"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tc_eq_type"><span class="hs-identifier hs-var">tc_eq_type</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862195"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862194"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1503"></span><span>
</span><span id="line-1504"></span><span class="hs-comment">-- | Like 'tcEqType', but returns True if the /visible/ part of the types</span><span>
</span><span id="line-1505"></span><span class="hs-comment">-- are equal, even if they are really unequal (in the invisible bits)</span><span>
</span><span id="line-1506"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcEqTypeVis"><span class="hs-identifier hs-type">tcEqTypeVis</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1507"></span><span id="tcEqTypeVis"><span class="annot"><span class="annottext">tcEqTypeVis :: Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcEqTypeVis"><span class="hs-identifier hs-var hs-var">tcEqTypeVis</span></a></span></span><span> </span><span id="local-6989586621680862193"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862193"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680862192"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862192"><span class="hs-identifier hs-var">ty2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tc_eq_type"><span class="hs-identifier hs-var">tc_eq_type</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862193"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862192"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1508"></span><span>
</span><span id="line-1509"></span><span class="hs-comment">-- | Like 'pickyEqTypeVis', but returns a Bool for convenience</span><span>
</span><span id="line-1510"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#pickyEqType"><span class="hs-identifier hs-type">pickyEqType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1511"></span><span class="hs-comment">-- Check when two types _look_ the same, _including_ synonyms.</span><span>
</span><span id="line-1512"></span><span class="hs-comment">-- So (pickyEqType String [Char]) returns False</span><span>
</span><span id="line-1513"></span><span class="hs-comment">-- This ignores kinds and coercions, because this is used only for printing.</span><span>
</span><span id="line-1514"></span><span id="pickyEqType"><span class="annot"><span class="annottext">pickyEqType :: Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#pickyEqType"><span class="hs-identifier hs-var hs-var">pickyEqType</span></a></span></span><span> </span><span id="local-6989586621680862191"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862191"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680862190"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862190"><span class="hs-identifier hs-var">ty2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tc_eq_type"><span class="hs-identifier hs-var">tc_eq_type</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862191"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862190"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1515"></span><span>
</span><span id="line-1516"></span><span>
</span><span id="line-1517"></span><span>
</span><span id="line-1518"></span><span class="hs-comment">-- | Real worker for 'tcEqType'. No kind check!</span><span>
</span><span id="line-1519"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tc_eq_type"><span class="hs-identifier hs-type">tc_eq_type</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>          </span><span class="hs-comment">-- ^ True &lt;=&gt; do not expand type synonyms</span><span>
</span><span id="line-1520"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>          </span><span class="hs-comment">-- ^ True &lt;=&gt; compare visible args only</span><span>
</span><span id="line-1521"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-1522"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1523"></span><span class="hs-comment">-- Flags False, False is the usual setting for tc_eq_type</span><span>
</span><span id="line-1524"></span><span id="tc_eq_type"><span class="annot"><span class="annottext">tc_eq_type :: Bool -&gt; Bool -&gt; Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tc_eq_type"><span class="hs-identifier hs-var hs-var">tc_eq_type</span></a></span></span><span> </span><span id="local-6989586621680862189"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862189"><span class="hs-identifier hs-var">keep_syns</span></a></span></span><span> </span><span id="local-6989586621680862188"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862188"><span class="hs-identifier hs-var">vis_only</span></a></span></span><span> </span><span id="local-6989586621680862187"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862187"><span class="hs-identifier hs-var">orig_ty1</span></a></span></span><span> </span><span id="local-6989586621680862186"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862186"><span class="hs-identifier hs-var">orig_ty2</span></a></span></span><span>
</span><span id="line-1525"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862184"><span class="hs-identifier hs-var">orig_env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862187"><span class="hs-identifier hs-var">orig_ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862186"><span class="hs-identifier hs-var">orig_ty2</span></a></span><span>
</span><span id="line-1526"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1527"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#RnEnv2"><span class="hs-identifier hs-type">RnEnv2</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1528"></span><span>    </span><span id="local-6989586621680862185"><span class="annot"><span class="annottext">go :: RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680862183"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862183"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680862182"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862182"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621680862181"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862181"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862189"><span class="hs-identifier hs-var">keep_syns</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862180"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862180"><span class="hs-identifier hs-var">t1'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862182"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862183"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862180"><span class="hs-identifier hs-var">t1'</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862181"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1529"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862179"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862179"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680862178"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862178"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621680862177"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862177"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862189"><span class="hs-identifier hs-var">keep_syns</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680862176"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862176"><span class="hs-identifier hs-var">t2'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862177"><span class="hs-identifier hs-var">t2</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862179"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862178"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862176"><span class="hs-identifier hs-var">t2'</span></a></span><span>
</span><span id="line-1530"></span><span>
</span><span id="line-1531"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862175"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862175"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span id="local-6989586621680862174"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862174"><span class="hs-identifier hs-var">tv1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span id="local-6989586621680862173"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862173"><span class="hs-identifier hs-var">tv2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1532"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; TcTyVar -&gt; TcTyVar
</span><a href="GHC.Types.Var.Env.html#rnOccL"><span class="hs-identifier hs-var">rnOccL</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862175"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862174"><span class="hs-identifier hs-var">tv1</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVar -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; TcTyVar -&gt; TcTyVar
</span><a href="GHC.Types.Var.Env.html#rnOccR"><span class="hs-identifier hs-var">rnOccR</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862175"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862173"><span class="hs-identifier hs-var">tv2</span></a></span><span>
</span><span id="line-1533"></span><span>
</span><span id="line-1534"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LitTy"><span class="hs-identifier hs-type">LitTy</span></a></span><span> </span><span id="local-6989586621680862170"><span class="annot"><span class="annottext">TyLit
</span><a href="#local-6989586621680862170"><span class="hs-identifier hs-var">lit1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LitTy"><span class="hs-identifier hs-type">LitTy</span></a></span><span> </span><span id="local-6989586621680862169"><span class="annot"><span class="annottext">TyLit
</span><a href="#local-6989586621680862169"><span class="hs-identifier hs-var">lit2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1535"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyLit
</span><a href="#local-6989586621680862170"><span class="hs-identifier hs-var">lit1</span></a></span><span> </span><span class="annot"><span class="annottext">TyLit -&gt; TyLit -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyLit
</span><a href="#local-6989586621680862169"><span class="hs-identifier hs-var">lit2</span></a></span><span>
</span><span id="line-1536"></span><span>
</span><span id="line-1537"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862168"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862168"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Bndr"><span class="hs-identifier hs-type">Bndr</span></a></span><span> </span><span id="local-6989586621680862166"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862166"><span class="hs-identifier hs-var">tv1</span></a></span></span><span> </span><span id="local-6989586621680862165"><span class="annot"><span class="annottext">ArgFlag
</span><a href="#local-6989586621680862165"><span class="hs-identifier hs-var">vis1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680862164"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862164"><span class="hs-identifier hs-var">ty1</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1538"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Bndr"><span class="hs-identifier hs-type">Bndr</span></a></span><span> </span><span id="local-6989586621680862163"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862163"><span class="hs-identifier hs-var">tv2</span></a></span></span><span> </span><span id="local-6989586621680862162"><span class="annot"><span class="annottext">ArgFlag
</span><a href="#local-6989586621680862162"><span class="hs-identifier hs-var">vis2</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680862161"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862161"><span class="hs-identifier hs-var">ty2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1539"></span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">ArgFlag
</span><a href="#local-6989586621680862165"><span class="hs-identifier hs-var">vis1</span></a></span><span> </span><span class="annot"><span class="annottext">ArgFlag -&gt; ArgFlag -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">ArgFlag
</span><a href="#local-6989586621680862162"><span class="hs-identifier hs-var">vis2</span></a></span><span>
</span><span id="line-1540"></span><span>      </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862188"><span class="hs-identifier hs-var">vis_only</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862168"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar -&gt; Type
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862166"><span class="hs-identifier hs-var">tv1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar -&gt; Type
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862163"><span class="hs-identifier hs-var">tv2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1541"></span><span>      </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RnEnv2 -&gt; TcTyVar -&gt; TcTyVar -&gt; RnEnv2
</span><a href="GHC.Types.Var.Env.html#rnBndr2"><span class="hs-identifier hs-var">rnBndr2</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862168"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862166"><span class="hs-identifier hs-var">tv1</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862163"><span class="hs-identifier hs-var">tv2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862164"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862161"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1542"></span><span>
</span><span id="line-1543"></span><span>    </span><span class="hs-comment">-- Make sure we handle all FunTy cases since falling through to the</span><span>
</span><span id="line-1544"></span><span>    </span><span class="hs-comment">-- AppTy case means that tcRepSplitAppTy_maybe may see an unzonked</span><span>
</span><span id="line-1545"></span><span>    </span><span class="hs-comment">-- kind variable, which causes things to blow up.</span><span>
</span><span id="line-1546"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862158"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862158"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680862157"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862157"><span class="hs-identifier hs-var">w1</span></a></span></span><span> </span><span id="local-6989586621680862156"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862156"><span class="hs-identifier hs-var">arg1</span></a></span></span><span> </span><span id="local-6989586621680862155"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862155"><span class="hs-identifier hs-var">res1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680862154"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862154"><span class="hs-identifier hs-var">w2</span></a></span></span><span> </span><span id="local-6989586621680862153"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862153"><span class="hs-identifier hs-var">arg2</span></a></span></span><span> </span><span id="local-6989586621680862152"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862152"><span class="hs-identifier hs-var">res2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1547"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862158"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862157"><span class="hs-identifier hs-var">w1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862154"><span class="hs-identifier hs-var">w2</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862158"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862156"><span class="hs-identifier hs-var">arg1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862153"><span class="hs-identifier hs-var">arg2</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862158"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862155"><span class="hs-identifier hs-var">res1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862152"><span class="hs-identifier hs-var">res2</span></a></span><span>
</span><span id="line-1548"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862151"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862151"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680862150"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862150"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680862149"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862149"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621680862148"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862148"><span class="hs-identifier hs-var">arg</span></a></span></span><span> </span><span id="local-6989586621680862147"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862147"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862146"><span class="hs-identifier hs-var">eqFunTy</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862151"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862149"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862148"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862147"><span class="hs-identifier hs-var">res</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862150"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1549"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862145"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862145"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680862144"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862144"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621680862143"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862143"><span class="hs-identifier hs-var">arg</span></a></span></span><span> </span><span id="local-6989586621680862142"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862142"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680862141"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862141"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862146"><span class="hs-identifier hs-var">eqFunTy</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862145"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862144"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862143"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862142"><span class="hs-identifier hs-var">res</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862141"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1550"></span><span>
</span><span id="line-1551"></span><span>      </span><span class="hs-comment">-- See Note [Equality on AppTys] in GHC.Core.Type</span><span>
</span><span id="line-1552"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862140"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862140"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppTy"><span class="hs-identifier hs-type">AppTy</span></a></span><span> </span><span id="local-6989586621680862139"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862139"><span class="hs-identifier hs-var">s1</span></a></span></span><span> </span><span id="local-6989586621680862138"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862138"><span class="hs-identifier hs-var">t1</span></a></span></span><span class="hs-special">)</span><span>        </span><span id="local-6989586621680862137"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862137"><span class="hs-identifier hs-var">ty2</span></a></span></span><span>
</span><span id="line-1553"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862136"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862136"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862135"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862135"><span class="hs-identifier hs-var">t2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Core.Type.html#tcRepSplitAppTy_maybe"><span class="hs-identifier hs-var">tcRepSplitAppTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862137"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1554"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862140"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862139"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862136"><span class="hs-identifier hs-var">s2</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862140"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862138"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862135"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1555"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862134"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862134"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680862133"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862133"><span class="hs-identifier hs-var">ty1</span></a></span></span><span>                  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppTy"><span class="hs-identifier hs-type">AppTy</span></a></span><span> </span><span id="local-6989586621680862132"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862132"><span class="hs-identifier hs-var">s2</span></a></span></span><span> </span><span id="local-6989586621680862131"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862131"><span class="hs-identifier hs-var">t2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1556"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862130"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862130"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862129"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862129"><span class="hs-identifier hs-var">t1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Core.Type.html#tcRepSplitAppTy_maybe"><span class="hs-identifier hs-var">tcRepSplitAppTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862133"><span class="hs-identifier hs-var">ty1</span></a></span><span>
</span><span id="line-1557"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862134"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862130"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862132"><span class="hs-identifier hs-var">s2</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862134"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862129"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862131"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1558"></span><span>
</span><span id="line-1559"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862128"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862128"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConApp"><span class="hs-identifier hs-type">TyConApp</span></a></span><span> </span><span id="local-6989586621680862127"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862127"><span class="hs-identifier hs-var">tc1</span></a></span></span><span> </span><span id="local-6989586621680862126"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862126"><span class="hs-identifier hs-var">ts1</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConApp"><span class="hs-identifier hs-type">TyConApp</span></a></span><span> </span><span id="local-6989586621680862125"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862125"><span class="hs-identifier hs-var">tc2</span></a></span></span><span> </span><span id="local-6989586621680862124"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862124"><span class="hs-identifier hs-var">ts2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1560"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862127"><span class="hs-identifier hs-var">tc1</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; TyCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862125"><span class="hs-identifier hs-var">tc2</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; [Bool] -&gt; [Type] -&gt; [Type] -&gt; Bool
</span><a href="#local-6989586621680862123"><span class="hs-identifier hs-var">gos</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862128"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [Bool]
</span><a href="#local-6989586621680862122"><span class="hs-identifier hs-var">tc_vis</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862127"><span class="hs-identifier hs-var">tc1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862126"><span class="hs-identifier hs-var">ts1</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862124"><span class="hs-identifier hs-var">ts2</span></a></span><span>
</span><span id="line-1561"></span><span>
</span><span id="line-1562"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862121"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862121"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span> </span><span id="local-6989586621680862120"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862120"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>   </span><span id="local-6989586621680862119"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862119"><span class="hs-identifier hs-var">t2</span></a></span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862121"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862120"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862119"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1563"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680862118"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862118"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680862117"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862117"><span class="hs-identifier hs-var">t1</span></a></span></span><span>              </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span> </span><span id="local-6989586621680862116"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862116"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862118"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862117"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862116"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1564"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1565"></span><span>
</span><span id="line-1566"></span><span>    </span><span class="annot"><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1567"></span><span>
</span><span id="line-1568"></span><span>    </span><span id="local-6989586621680862123"><span class="annot"><span class="annottext">gos :: RnEnv2 -&gt; [Bool] -&gt; [Type] -&gt; [Type] -&gt; Bool
</span><a href="#local-6989586621680862123"><span class="hs-identifier hs-var hs-var">gos</span></a></span></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><span class="hs-identifier">_</span></span><span>   </span><span class="annot"><span class="annottext">[Bool]
</span><span class="hs-identifier">_</span></span><span>         </span><span class="hs-special">[</span><span class="hs-special">]</span><span>       </span><span class="hs-special">[</span><span class="hs-special">]</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1569"></span><span>    </span><span class="annot"><a href="#local-6989586621680862123"><span class="hs-identifier hs-var">gos</span></a></span><span> </span><span id="local-6989586621680862115"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862115"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862114"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862114"><span class="hs-identifier hs-var">ig</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680862113"><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680862113"><span class="hs-identifier hs-var">igs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862112"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862112"><span class="hs-identifier hs-var">t1</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680862111"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862111"><span class="hs-identifier hs-var">ts1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862110"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862110"><span class="hs-identifier hs-var">t2</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680862109"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862109"><span class="hs-identifier hs-var">ts2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862114"><span class="hs-identifier hs-var">ig</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862115"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862112"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862110"><span class="hs-identifier hs-var">t2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1570"></span><span>                                      </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; [Bool] -&gt; [Type] -&gt; [Type] -&gt; Bool
</span><a href="#local-6989586621680862123"><span class="hs-identifier hs-var">gos</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862115"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680862113"><span class="hs-identifier hs-var">igs</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862111"><span class="hs-identifier hs-var">ts1</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862109"><span class="hs-identifier hs-var">ts2</span></a></span><span>
</span><span id="line-1571"></span><span>    </span><span class="annot"><a href="#local-6989586621680862123"><span class="hs-identifier hs-var">gos</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1572"></span><span>
</span><span id="line-1573"></span><span>    </span><span class="annot"><a href="#local-6989586621680862122"><span class="hs-identifier hs-type">tc_vis</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- True for the fields we should ignore</span><span>
</span><span id="line-1574"></span><span>    </span><span id="local-6989586621680862122"><span class="annot"><span class="annottext">tc_vis :: TyCon -&gt; [Bool]
</span><a href="#local-6989586621680862122"><span class="hs-identifier hs-var hs-var">tc_vis</span></a></span></span><span> </span><span id="local-6989586621680862108"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862108"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862188"><span class="hs-identifier hs-var">vis_only</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680862107"><span class="hs-identifier hs-var">inviss</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; [Bool] -&gt; [Bool]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; [Bool]
forall a. a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#repeat"><span class="hs-identifier hs-var">repeat</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>    </span><span class="hs-comment">-- Ignore invisibles</span><span>
</span><span id="line-1575"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; [Bool]
forall a. a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#repeat"><span class="hs-identifier hs-var">repeat</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>              </span><span class="hs-comment">-- Ignore nothing</span><span>
</span><span id="line-1576"></span><span>       </span><span class="hs-comment">-- The repeat False is necessary because tycons</span><span>
</span><span id="line-1577"></span><span>       </span><span class="hs-comment">-- can legitimately be oversaturated</span><span>
</span><span id="line-1578"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-1579"></span><span>        </span><span id="local-6989586621680862105"><span class="annot"><span class="annottext">bndrs :: [TyConBinder]
</span><a href="#local-6989586621680862105"><span class="hs-identifier hs-var hs-var">bndrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [TyConBinder]
</span><a href="GHC.Core.TyCon.html#tyConBinders"><span class="hs-identifier hs-var hs-var">tyConBinders</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862108"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-1580"></span><span>        </span><span id="local-6989586621680862107"><span class="annot"><span class="annottext">inviss :: [Bool]
</span><a href="#local-6989586621680862107"><span class="hs-identifier hs-var hs-var">inviss</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyConBinder -&gt; Bool) -&gt; [TyConBinder] -&gt; [Bool]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">TyConBinder -&gt; Bool
forall tv. VarBndr tv TyConBndrVis -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isInvisibleTyConBinder"><span class="hs-identifier hs-var">isInvisibleTyConBinder</span></a></span><span> </span><span class="annot"><span class="annottext">[TyConBinder]
</span><a href="#local-6989586621680862105"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-1581"></span><span>
</span><span id="line-1582"></span><span>    </span><span id="local-6989586621680862184"><span class="annot"><span class="annottext">orig_env :: RnEnv2
</span><a href="#local-6989586621680862184"><span class="hs-identifier hs-var hs-var">orig_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; RnEnv2
</span><a href="GHC.Types.Var.Env.html#mkRnEnv2"><span class="hs-identifier hs-var">mkRnEnv2</span></a></span><span> </span><span class="annot"><span class="annottext">(InScopeSet -&gt; RnEnv2) -&gt; InScopeSet -&gt; RnEnv2
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet -&gt; InScopeSet
</span><a href="GHC.Types.Var.Env.html#mkInScopeSet"><span class="hs-identifier hs-var">mkInScopeSet</span></a></span><span> </span><span class="annot"><span class="annottext">(VarSet -&gt; InScopeSet) -&gt; VarSet -&gt; InScopeSet
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; VarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypes"><span class="hs-identifier hs-var">tyCoVarsOfTypes</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862187"><span class="hs-identifier hs-var">orig_ty1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862186"><span class="hs-identifier hs-var">orig_ty2</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1583"></span><span>
</span><span id="line-1584"></span><span>    </span><span class="hs-comment">-- @eqFunTy w arg res ty@ is True when @ty@ equals @FunTy w arg res@. This is</span><span>
</span><span id="line-1585"></span><span>    </span><span class="hs-comment">-- sometimes hard to know directly because @ty@ might have some casts</span><span>
</span><span id="line-1586"></span><span>    </span><span class="hs-comment">-- obscuring the FunTy. And 'splitAppTy' is difficult because we can't</span><span>
</span><span id="line-1587"></span><span>    </span><span class="hs-comment">-- always extract a RuntimeRep (see Note [xyz]) if the kind of the arg or</span><span>
</span><span id="line-1588"></span><span>    </span><span class="hs-comment">-- res is unzonked/unflattened. Thus this function, which handles this</span><span>
</span><span id="line-1589"></span><span>    </span><span class="hs-comment">-- corner case.</span><span>
</span><span id="line-1590"></span><span>    </span><span class="annot"><a href="#local-6989586621680862146"><span class="hs-identifier hs-type">eqFunTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#RnEnv2"><span class="hs-identifier hs-type">RnEnv2</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Mult"><span class="hs-identifier hs-type">Mult</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1591"></span><span>               </span><span class="hs-comment">-- Last arg is /not/ FunTy</span><span>
</span><span id="line-1592"></span><span>    </span><span id="local-6989586621680862146"><span class="annot"><span class="annottext">eqFunTy :: RnEnv2 -&gt; Type -&gt; Type -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862146"><span class="hs-identifier hs-var hs-var">eqFunTy</span></a></span></span><span> </span><span id="local-6989586621680862099"><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862099"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680862098"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862098"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621680862097"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862097"><span class="hs-identifier hs-var">arg</span></a></span></span><span> </span><span id="local-6989586621680862096"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862096"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span id="local-6989586621680862095"><span class="annot"><span class="annottext">ty :: Type
</span><a href="#local-6989586621680862095"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppTy"><span class="hs-identifier hs-type">AppTy</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; Bool
</span><a href="#local-6989586621680862094"><span class="hs-identifier hs-var">get_args</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862095"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1593"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-1594"></span><span>        </span><span class="annot"><a href="#local-6989586621680862094"><span class="hs-identifier hs-type">get_args</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1595"></span><span>        </span><span id="local-6989586621680862094"><span class="annot"><span class="annottext">get_args :: Type -&gt; [Type] -&gt; Bool
</span><a href="#local-6989586621680862094"><span class="hs-identifier hs-var hs-var">get_args</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppTy"><span class="hs-identifier hs-type">AppTy</span></a></span><span> </span><span id="local-6989586621680862093"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862093"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680862092"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862092"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>       </span><span id="local-6989586621680862091"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862091"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; Bool
</span><a href="#local-6989586621680862094"><span class="hs-identifier hs-var">get_args</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862093"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862092"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; [Type]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862091"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1596"></span><span>        </span><span class="annot"><a href="#local-6989586621680862094"><span class="hs-identifier hs-var">get_args</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span> </span><span id="local-6989586621680862090"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862090"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>      </span><span id="local-6989586621680862089"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862089"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; Bool
</span><a href="#local-6989586621680862094"><span class="hs-identifier hs-var">get_args</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862090"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862089"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-1597"></span><span>        </span><span class="annot"><a href="#local-6989586621680862094"><span class="hs-identifier hs-var">get_args</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConApp"><span class="hs-identifier hs-type">TyConApp</span></a></span><span> </span><span id="local-6989586621680862088"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862088"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680862087"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862087"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680862086"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862086"><span class="hs-identifier hs-var">args</span></a></span></span><span>
</span><span id="line-1598"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862088"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; TyCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.Prim.html#funTyCon"><span class="hs-identifier hs-var">funTyCon</span></a></span><span>
</span><span id="line-1599"></span><span>          </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span id="local-6989586621680862085"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862085"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862084"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862084"><span class="hs-identifier hs-var">arg'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862083"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862083"><span class="hs-identifier hs-var">res'</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862087"><span class="hs-identifier hs-var">tys</span></a></span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; [Type] -&gt; [Type]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862086"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-1600"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862099"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862098"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862085"><span class="hs-identifier hs-var">w'</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862099"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862097"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862084"><span class="hs-identifier hs-var">arg'</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">RnEnv2 -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862185"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><a href="#local-6989586621680862099"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862096"><span class="hs-identifier hs-var">res</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862083"><span class="hs-identifier hs-var">res'</span></a></span><span>
</span><span id="line-1601"></span><span>        </span><span class="annot"><a href="#local-6989586621680862094"><span class="hs-identifier hs-var">get_args</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1602"></span><span>    </span><span class="annot"><a href="#local-6989586621680862146"><span class="hs-identifier hs-var">eqFunTy</span></a></span><span> </span><span class="annot"><span class="annottext">RnEnv2
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1603"></span><span>
</span><span id="line-1604"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
                       Predicate types
*                                                                      *
************************************************************************

Deconstructors and tests on predicate types

Note [Kind polymorphic type classes]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    class C f where...   -- C :: forall k. k -&gt; Constraint
    g :: forall (f::*). C f =&gt; f -&gt; f

Here the (C f) in the signature is really (C * f), and we
don't want to complain that the * isn't a type variable!
-}</span><span>
</span><span id="line-1620"></span><span>
</span><span id="line-1621"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyVarClassPred"><span class="hs-identifier hs-type">isTyVarClassPred</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1622"></span><span id="isTyVarClassPred"><span class="annot"><span class="annottext">isTyVarClassPred :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isTyVarClassPred"><span class="hs-identifier hs-var hs-var">isTyVarClassPred</span></a></span></span><span> </span><span id="local-6989586621680862082"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862082"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Class, [Type])
</span><a href="GHC.Core.Predicate.html#getClassPredTys_maybe"><span class="hs-identifier hs-var">getClassPredTys_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862082"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1623"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862080"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862080"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Bool) -&gt; [Type] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isTyVarTy"><span class="hs-identifier hs-var">isTyVarTy</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862080"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-1624"></span><span>    </span><span class="annot"><span class="annottext">Maybe (Class, [Type])
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1625"></span><span>
</span><span id="line-1626"></span><span class="hs-comment">-------------------------</span><span>
</span><span id="line-1627"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#checkValidClsArgs"><span class="hs-identifier hs-type">checkValidClsArgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#KindOrType"><span class="hs-identifier hs-type">KindOrType</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1628"></span><span class="hs-comment">-- If the Bool is True (flexible contexts), return True (i.e. ok)</span><span>
</span><span id="line-1629"></span><span class="hs-comment">-- Otherwise, check that the type (not kind) args are all headed by a tyvar</span><span>
</span><span id="line-1630"></span><span class="hs-comment">--   E.g. (Eq a) accepted, (Eq (f a)) accepted, but (Eq Int) rejected</span><span>
</span><span id="line-1631"></span><span class="hs-comment">-- This function is here rather than in GHC.Tc.Validity because it is</span><span>
</span><span id="line-1632"></span><span class="hs-comment">-- called from GHC.Tc.Solver, which itself is imported by GHC.Tc.Validity</span><span>
</span><span id="line-1633"></span><span id="checkValidClsArgs"><span class="annot"><span class="annottext">checkValidClsArgs :: Bool -&gt; Class -&gt; [Type] -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#checkValidClsArgs"><span class="hs-identifier hs-var hs-var">checkValidClsArgs</span></a></span></span><span> </span><span id="local-6989586621680862078"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862078"><span class="hs-identifier hs-var">flexible_contexts</span></a></span></span><span> </span><span id="local-6989586621680862077"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680862077"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span id="local-6989586621680862076"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862076"><span class="hs-identifier hs-var">kts</span></a></span></span><span>
</span><span id="line-1634"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862078"><span class="hs-identifier hs-var">flexible_contexts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1635"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Bool) -&gt; [Type] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#hasTyVarHead"><span class="hs-identifier hs-var">hasTyVarHead</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862075"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-1636"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1637"></span><span>    </span><span id="local-6989586621680862075"><span class="annot"><span class="annottext">tys :: [Type]
</span><a href="#local-6989586621680862075"><span class="hs-identifier hs-var hs-var">tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; [Type]
</span><a href="GHC.Core.Type.html#filterOutInvisibleTypes"><span class="hs-identifier hs-var">filterOutInvisibleTypes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; TyCon
</span><a href="GHC.Core.Class.html#classTyCon"><span class="hs-identifier hs-var hs-var">classTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680862077"><span class="hs-identifier hs-var">cls</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862076"><span class="hs-identifier hs-var">kts</span></a></span><span>
</span><span id="line-1638"></span><span>
</span><span id="line-1639"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#hasTyVarHead"><span class="hs-identifier hs-type">hasTyVarHead</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1640"></span><span class="hs-comment">-- Returns true of (a t1 .. tn), where 'a' is a type variable</span><span>
</span><span id="line-1641"></span><span id="hasTyVarHead"><span class="annot"><span class="annottext">hasTyVarHead :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#hasTyVarHead"><span class="hs-identifier hs-var hs-var">hasTyVarHead</span></a></span></span><span> </span><span id="local-6989586621680862072"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862072"><span class="hs-identifier hs-var">ty</span></a></span></span><span>                 </span><span class="hs-comment">-- Haskell 98 allows predicates of form</span><span>
</span><span id="line-1642"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcIsTyVarTy"><span class="hs-identifier hs-var">tcIsTyVarTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862072"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>       </span><span class="hs-comment">--      C (a ty1 .. tyn)</span><span>
</span><span id="line-1643"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                   </span><span class="hs-comment">-- where a is a type variable</span><span>
</span><span id="line-1644"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTy_maybe"><span class="hs-identifier hs-var">tcSplitAppTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862072"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1645"></span><span>       </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862071"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862071"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#hasTyVarHead"><span class="hs-identifier hs-var">hasTyVarHead</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862071"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1646"></span><span>       </span><span class="annot"><span class="annottext">Maybe (Type, Type)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1647"></span><span>
</span><span id="line-1648"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#evVarPred"><span class="hs-identifier hs-type">evVarPred</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier hs-type">EvVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span>
</span><span id="line-1649"></span><span id="evVarPred"><span class="annot"><span class="annottext">evVarPred :: TcTyVar -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#evVarPred"><span class="hs-identifier hs-var hs-var">evVarPred</span></a></span></span><span> </span><span id="local-6989586621680862069"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862069"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Type
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680862069"><span class="hs-identifier hs-var">var</span></a></span><span>
</span><span id="line-1650"></span><span>  </span><span class="hs-comment">-- Historical note: I used to have an ASSERT here,</span><span>
</span><span id="line-1651"></span><span>  </span><span class="hs-comment">-- checking (isEvVarType (varType var)).  But with something like</span><span>
</span><span id="line-1652"></span><span>  </span><span class="hs-comment">--   f :: c =&gt; _ -&gt; _</span><span>
</span><span id="line-1653"></span><span>  </span><span class="hs-comment">-- we end up with (c :: kappa), and (kappa ~ Constraint).  Until</span><span>
</span><span id="line-1654"></span><span>  </span><span class="hs-comment">-- we solve and zonk (which there is no particular reason to do for</span><span>
</span><span id="line-1655"></span><span>  </span><span class="hs-comment">-- partial signatures, (isEvVarType kappa) will return False. But</span><span>
</span><span id="line-1656"></span><span>  </span><span class="hs-comment">-- nothing is wrong.  So I just removed the ASSERT.</span><span>
</span><span id="line-1657"></span><span>
</span><span id="line-1658"></span><span class="hs-comment">------------------</span><span>
</span><span id="line-1659"></span><span class="hs-comment">-- | When inferring types, should we quantify over a given predicate?</span><span>
</span><span id="line-1660"></span><span class="hs-comment">-- Generally true of classes; generally false of equality constraints.</span><span>
</span><span id="line-1661"></span><span class="hs-comment">-- Equality constraints that mention quantified type variables and</span><span>
</span><span id="line-1662"></span><span class="hs-comment">-- implicit variables complicate the story. See Notes</span><span>
</span><span id="line-1663"></span><span class="hs-comment">-- [Inheriting implicit parameters] and [Quantifying over equality constraints]</span><span>
</span><span id="line-1664"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#pickQuantifiablePreds"><span class="hs-identifier hs-type">pickQuantifiablePreds</span></a></span><span>
</span><span id="line-1665"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#TyVarSet"><span class="hs-identifier hs-type">TyVarSet</span></a></span><span>           </span><span class="hs-comment">-- Quantifying over these</span><span>
</span><span id="line-1666"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-type">TcThetaType</span></a></span><span>        </span><span class="hs-comment">-- Proposed constraints to quantify</span><span>
</span><span id="line-1667"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-type">TcThetaType</span></a></span><span>        </span><span class="hs-comment">-- A subset that we can actually quantify</span><span>
</span><span id="line-1668"></span><span class="hs-comment">-- This function decides whether a particular constraint should be</span><span>
</span><span id="line-1669"></span><span class="hs-comment">-- quantified over, given the type variables that are being quantified</span><span>
</span><span id="line-1670"></span><span id="pickQuantifiablePreds"><span class="annot"><span class="annottext">pickQuantifiablePreds :: VarSet -&gt; [Type] -&gt; [Type]
</span><a href="GHC.Tc.Utils.TcType.html#pickQuantifiablePreds"><span class="hs-identifier hs-var hs-var">pickQuantifiablePreds</span></a></span></span><span> </span><span id="local-6989586621680862068"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862068"><span class="hs-identifier hs-var">qtvs</span></a></span></span><span> </span><span id="local-6989586621680862067"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862067"><span class="hs-identifier hs-var">theta</span></a></span></span><span>
</span><span id="line-1671"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680862066"><span class="annot"><span class="annottext">flex_ctxt :: Bool
</span><a href="#local-6989586621680862066"><span class="hs-identifier hs-var hs-var">flex_ctxt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-keyword">in</span><span>  </span><span class="hs-comment">-- Quantify over non-tyvar constraints, even without</span><span>
</span><span id="line-1672"></span><span>                             </span><span class="hs-comment">-- -XFlexibleContexts: see #10608, #10351</span><span>
</span><span id="line-1673"></span><span>         </span><span class="hs-comment">-- flex_ctxt &lt;- xoptM Opt_FlexibleContexts</span><span>
</span><span id="line-1674"></span><span>    </span><span class="annot"><span class="annottext">(Type -&gt; Maybe Type) -&gt; [Type] -&gt; [Type]
forall a b. (a -&gt; Maybe b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/Data.Maybe.html#mapMaybe"><span class="hs-identifier hs-var">mapMaybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Type -&gt; Maybe Type
</span><a href="#local-6989586621680862064"><span class="hs-identifier hs-var">pick_me</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862066"><span class="hs-identifier hs-var">flex_ctxt</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862067"><span class="hs-identifier hs-var">theta</span></a></span><span>
</span><span id="line-1675"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1676"></span><span>    </span><span id="local-6989586621680862064"><span class="annot"><span class="annottext">pick_me :: Bool -&gt; Type -&gt; Maybe Type
</span><a href="#local-6989586621680862064"><span class="hs-identifier hs-var hs-var">pick_me</span></a></span></span><span> </span><span id="local-6989586621680862063"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862063"><span class="hs-identifier hs-var">flex_ctxt</span></a></span></span><span> </span><span id="local-6989586621680862062"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862062"><span class="hs-identifier hs-var">pred</span></a></span></span><span>
</span><span id="line-1677"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Pred
</span><a href="GHC.Core.Predicate.html#classifyPredType"><span class="hs-identifier hs-var">classifyPredType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862062"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1678"></span><span>
</span><span id="line-1679"></span><span>          </span><span class="annot"><a href="GHC.Core.Predicate.html#ClassPred"><span class="hs-identifier hs-type">ClassPred</span></a></span><span> </span><span id="local-6989586621680862059"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680862059"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span id="local-6989586621680862058"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862058"><span class="hs-identifier hs-var">tys</span></a></span></span><span>
</span><span id="line-1680"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Class -&gt; [Type] -&gt; Maybe FastString
</span><a href="GHC.Tc.Utils.TcType.html#isCallStackPred"><span class="hs-identifier hs-var">isCallStackPred</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680862059"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862058"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-1681"></span><span>              </span><span class="hs-comment">-- NEVER infer a CallStack constraint.  Otherwise we let</span><span>
</span><span id="line-1682"></span><span>              </span><span class="hs-comment">-- the constraints bubble up to be solved from the outer</span><span>
</span><span id="line-1683"></span><span>              </span><span class="hs-comment">-- context, or be defaulted when we reach the top-level.</span><span>
</span><span id="line-1684"></span><span>              </span><span class="hs-comment">-- See Note [Overview of implicit CallStacks]</span><span>
</span><span id="line-1685"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe Type
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1686"></span><span>
</span><span id="line-1687"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isIPClass"><span class="hs-identifier hs-var">isIPClass</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680862059"><span class="hs-identifier hs-var">cls</span></a></span><span>
</span><span id="line-1688"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862062"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="hs-comment">-- See note [Inheriting implicit parameters]</span><span>
</span><span id="line-1689"></span><span>
</span><span id="line-1690"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Class -&gt; [Type] -&gt; Bool
</span><a href="#local-6989586621680862056"><span class="hs-identifier hs-var">pick_cls_pred</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862063"><span class="hs-identifier hs-var">flex_ctxt</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680862059"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862058"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-1691"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862062"><span class="hs-identifier hs-var">pred</span></a></span><span>
</span><span id="line-1692"></span><span>
</span><span id="line-1693"></span><span>          </span><span class="annot"><a href="GHC.Core.Predicate.html#EqPred"><span class="hs-identifier hs-type">EqPred</span></a></span><span> </span><span id="local-6989586621680862054"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862054"><span class="hs-identifier hs-var">eq_rel</span></a></span></span><span> </span><span id="local-6989586621680862053"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862053"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680862052"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862052"><span class="hs-identifier hs-var">ty2</span></a></span></span><span>
</span><span id="line-1694"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862051"><span class="hs-identifier hs-var">quantify_equality</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862054"><span class="hs-identifier hs-var">eq_rel</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862053"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862052"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1695"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862050"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680862050"><span class="hs-identifier hs-var">cls</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862049"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862049"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; Type -&gt; Type -&gt; Maybe (Class, [Type])
</span><a href="GHC.Tc.Utils.TcType.html#boxEqPred"><span class="hs-identifier hs-var">boxEqPred</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862054"><span class="hs-identifier hs-var">eq_rel</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862053"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862052"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1696"></span><span>              </span><span class="hs-comment">-- boxEqPred: See Note [Lift equality constraints when quantifying]</span><span>
</span><span id="line-1697"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Class -&gt; [Type] -&gt; Bool
</span><a href="#local-6989586621680862056"><span class="hs-identifier hs-var">pick_cls_pred</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862063"><span class="hs-identifier hs-var">flex_ctxt</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680862050"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862049"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-1698"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.Predicate.html#mkClassPred"><span class="hs-identifier hs-var">mkClassPred</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680862050"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862049"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1699"></span><span>
</span><span id="line-1700"></span><span>          </span><span class="annot"><a href="GHC.Core.Predicate.html#IrredPred"><span class="hs-identifier hs-type">IrredPred</span></a></span><span> </span><span id="local-6989586621680862047"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862047"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1701"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type -&gt; VarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfType"><span class="hs-identifier hs-var">tyCoVarsOfType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862047"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet -&gt; VarSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#intersectsVarSet"><span class="hs-operator hs-var">`intersectsVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862068"><span class="hs-identifier hs-var">qtvs</span></a></span><span>
</span><span id="line-1702"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862062"><span class="hs-identifier hs-var">pred</span></a></span><span>
</span><span id="line-1703"></span><span>
</span><span id="line-1704"></span><span>          </span><span class="annot"><span class="annottext">Pred
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe Type
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1705"></span><span>
</span><span id="line-1706"></span><span>
</span><span id="line-1707"></span><span>    </span><span id="local-6989586621680862056"><span class="annot"><span class="annottext">pick_cls_pred :: Bool -&gt; Class -&gt; [Type] -&gt; Bool
</span><a href="#local-6989586621680862056"><span class="hs-identifier hs-var hs-var">pick_cls_pred</span></a></span></span><span> </span><span id="local-6989586621680862045"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862045"><span class="hs-identifier hs-var">flex_ctxt</span></a></span></span><span> </span><span id="local-6989586621680862044"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680862044"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span id="local-6989586621680862043"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862043"><span class="hs-identifier hs-var">tys</span></a></span></span><span>
</span><span id="line-1708"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; VarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypes"><span class="hs-identifier hs-var">tyCoVarsOfTypes</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862043"><span class="hs-identifier hs-var">tys</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet -&gt; VarSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#intersectsVarSet"><span class="hs-operator hs-var">`intersectsVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862068"><span class="hs-identifier hs-var">qtvs</span></a></span><span>
</span><span id="line-1709"></span><span>        </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Class -&gt; [Type] -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#checkValidClsArgs"><span class="hs-identifier hs-var">checkValidClsArgs</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862045"><span class="hs-identifier hs-var">flex_ctxt</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680862044"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862043"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1710"></span><span>           </span><span class="hs-comment">-- Only quantify over predicates that checkValidType</span><span>
</span><span id="line-1711"></span><span>           </span><span class="hs-comment">-- will pass!  See #10351.</span><span>
</span><span id="line-1712"></span><span>
</span><span id="line-1713"></span><span>    </span><span class="hs-comment">-- See Note [Quantifying over equality constraints]</span><span>
</span><span id="line-1714"></span><span>    </span><span id="local-6989586621680862051"><span class="annot"><span class="annottext">quantify_equality :: EqRel -&gt; Type -&gt; Type -&gt; Bool
</span><a href="#local-6989586621680862051"><span class="hs-identifier hs-var hs-var">quantify_equality</span></a></span></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span>  </span><span id="local-6989586621680862042"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862042"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680862041"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862041"><span class="hs-identifier hs-var">ty2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680862040"><span class="hs-identifier hs-var">quant_fun</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862042"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680862040"><span class="hs-identifier hs-var">quant_fun</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862041"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1715"></span><span>    </span><span class="annot"><a href="#local-6989586621680862051"><span class="hs-identifier hs-var">quantify_equality</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>   </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1716"></span><span>
</span><span id="line-1717"></span><span>    </span><span id="local-6989586621680862040"><span class="annot"><span class="annottext">quant_fun :: Type -&gt; Bool
</span><a href="#local-6989586621680862040"><span class="hs-identifier hs-var hs-var">quant_fun</span></a></span></span><span> </span><span id="local-6989586621680862037"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862037"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1718"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#tcSplitTyConApp_maybe"><span class="hs-identifier hs-var">tcSplitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862037"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1719"></span><span>          </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862036"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862036"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680862035"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862035"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isTypeFamilyTyCon"><span class="hs-identifier hs-var">isTypeFamilyTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680862036"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-1720"></span><span>                         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; VarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypes"><span class="hs-identifier hs-var">tyCoVarsOfTypes</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862035"><span class="hs-identifier hs-var">tys</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet -&gt; VarSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#intersectsVarSet"><span class="hs-operator hs-var">`intersectsVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862068"><span class="hs-identifier hs-var">qtvs</span></a></span><span>
</span><span id="line-1721"></span><span>          </span><span class="annot"><span class="annottext">Maybe (TyCon, [Type])
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1722"></span><span>
</span><span id="line-1723"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#boxEqPred"><span class="hs-identifier hs-type">boxEqPred</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1724"></span><span class="hs-comment">-- Given (t1 ~# t2) or (t1 ~R# t2) return the boxed version</span><span>
</span><span id="line-1725"></span><span class="hs-comment">--       (t1 ~ t2)  or (t1 `Coercible` t2)</span><span>
</span><span id="line-1726"></span><span id="boxEqPred"><span class="annot"><span class="annottext">boxEqPred :: EqRel -&gt; Type -&gt; Type -&gt; Maybe (Class, [Type])
</span><a href="GHC.Tc.Utils.TcType.html#boxEqPred"><span class="hs-identifier hs-var hs-var">boxEqPred</span></a></span></span><span> </span><span id="local-6989586621680862034"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862034"><span class="hs-identifier hs-var">eq_rel</span></a></span></span><span> </span><span id="local-6989586621680862033"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862033"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680862032"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862032"><span class="hs-identifier hs-var">ty2</span></a></span></span><span>
</span><span id="line-1727"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680862034"><span class="hs-identifier hs-var">eq_rel</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1728"></span><span>      </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862031"><span class="hs-identifier hs-var">homo_kind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Class, [Type]) -&gt; Maybe (Class, [Type])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class
</span><a href="GHC.Builtin.Types.html#eqClass"><span class="hs-identifier hs-var">eqClass</span></a></span><span class="hs-special">,</span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862030"><span class="hs-identifier hs-var">k1</span></a></span><span class="hs-special">,</span><span>     </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862033"><span class="hs-identifier hs-var">ty1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862032"><span class="hs-identifier hs-var">ty2</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1729"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Class, [Type]) -&gt; Maybe (Class, [Type])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class
</span><a href="GHC.Builtin.Types.html#heqClass"><span class="hs-identifier hs-var">heqClass</span></a></span><span class="hs-special">,</span><span>       </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862030"><span class="hs-identifier hs-var">k1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862029"><span class="hs-identifier hs-var">k2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862033"><span class="hs-identifier hs-var">ty1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862032"><span class="hs-identifier hs-var">ty2</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1730"></span><span>      </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680862031"><span class="hs-identifier hs-var">homo_kind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Class, [Type]) -&gt; Maybe (Class, [Type])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class
</span><a href="GHC.Builtin.Types.html#coercibleClass"><span class="hs-identifier hs-var">coercibleClass</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862030"><span class="hs-identifier hs-var">k1</span></a></span><span class="hs-special">,</span><span>     </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862033"><span class="hs-identifier hs-var">ty1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862032"><span class="hs-identifier hs-var">ty2</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1731"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (Class, [Type])
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-comment">-- Sigh: we do not have hererogeneous Coercible</span><span>
</span><span id="line-1732"></span><span>                                    </span><span class="hs-comment">--       so we can't abstract over it</span><span>
</span><span id="line-1733"></span><span>                                    </span><span class="hs-comment">-- Nothing fundamental: we could add it</span><span>
</span><span id="line-1734"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1735"></span><span>   </span><span id="local-6989586621680862030"><span class="annot"><span class="annottext">k1 :: Type
</span><a href="#local-6989586621680862030"><span class="hs-identifier hs-var hs-var">k1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Type
Type -&gt; Type
</span><a href="GHC.Core.Type.html#tcTypeKind"><span class="hs-identifier hs-var">tcTypeKind</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862033"><span class="hs-identifier hs-var">ty1</span></a></span><span>
</span><span id="line-1736"></span><span>   </span><span id="local-6989586621680862029"><span class="annot"><span class="annottext">k2 :: Type
</span><a href="#local-6989586621680862029"><span class="hs-identifier hs-var hs-var">k2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Type
Type -&gt; Type
</span><a href="GHC.Core.Type.html#tcTypeKind"><span class="hs-identifier hs-var">tcTypeKind</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862032"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-1737"></span><span>   </span><span id="local-6989586621680862031"><span class="annot"><span class="annottext">homo_kind :: Bool
</span><a href="#local-6989586621680862031"><span class="hs-identifier hs-var hs-var">homo_kind</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862030"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Type -&gt; Bool
Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcEqType"><span class="hs-operator hs-var">`tcEqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862029"><span class="hs-identifier hs-var">k2</span></a></span><span>
</span><span id="line-1738"></span><span>
</span><span id="line-1739"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#pickCapturedPreds"><span class="hs-identifier hs-type">pickCapturedPreds</span></a></span><span>
</span><span id="line-1740"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#TyVarSet"><span class="hs-identifier hs-type">TyVarSet</span></a></span><span>           </span><span class="hs-comment">-- Quantifying over these</span><span>
</span><span id="line-1741"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-type">TcThetaType</span></a></span><span>        </span><span class="hs-comment">-- Proposed constraints to quantify</span><span>
</span><span id="line-1742"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-type">TcThetaType</span></a></span><span>        </span><span class="hs-comment">-- A subset that we can actually quantify</span><span>
</span><span id="line-1743"></span><span class="hs-comment">-- A simpler version of pickQuantifiablePreds, used to winnow down</span><span>
</span><span id="line-1744"></span><span class="hs-comment">-- the inferred constraints of a group of bindings, into those for</span><span>
</span><span id="line-1745"></span><span class="hs-comment">-- one particular identifier</span><span>
</span><span id="line-1746"></span><span id="pickCapturedPreds"><span class="annot"><span class="annottext">pickCapturedPreds :: VarSet -&gt; [Type] -&gt; [Type]
</span><a href="GHC.Tc.Utils.TcType.html#pickCapturedPreds"><span class="hs-identifier hs-var hs-var">pickCapturedPreds</span></a></span></span><span> </span><span id="local-6989586621680862025"><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862025"><span class="hs-identifier hs-var">qtvs</span></a></span></span><span> </span><span id="local-6989586621680862024"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862024"><span class="hs-identifier hs-var">theta</span></a></span></span><span>
</span><span id="line-1747"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Bool) -&gt; [Type] -&gt; [Type]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680862023"><span class="hs-identifier hs-var">captured</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680862024"><span class="hs-identifier hs-var">theta</span></a></span><span>
</span><span id="line-1748"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1749"></span><span>    </span><span id="local-6989586621680862023"><span class="annot"><span class="annottext">captured :: Type -&gt; Bool
</span><a href="#local-6989586621680862023"><span class="hs-identifier hs-var hs-var">captured</span></a></span></span><span> </span><span id="local-6989586621680862022"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862022"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isIPLikePred"><span class="hs-identifier hs-var">isIPLikePred</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862022"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; VarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfType"><span class="hs-identifier hs-var">tyCoVarsOfType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862022"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet -&gt; VarSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#intersectsVarSet"><span class="hs-operator hs-var">`intersectsVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">VarSet
</span><a href="#local-6989586621680862025"><span class="hs-identifier hs-var">qtvs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1750"></span><span>
</span><span id="line-1751"></span><span>
</span><span id="line-1752"></span><span class="hs-comment">-- Superclasses</span><span>
</span><span id="line-1753"></span><span>
</span><span id="line-1754"></span><span class="hs-keyword">type</span><span> </span><span id="PredWithSCs"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#PredWithSCs"><span class="hs-identifier hs-var">PredWithSCs</span></a></span></span><span> </span><span id="local-6989586621680862021"><span class="annot"><a href="#local-6989586621680862021"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680862021"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1755"></span><span>
</span><span id="line-1756"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#mkMinimalBySCs"><span class="hs-identifier hs-type">mkMinimalBySCs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621680863242"><span class="annot"><a href="#local-6989586621680863242"><span class="hs-identifier hs-type">a</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680863242"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680863242"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680863242"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1757"></span><span class="hs-comment">-- Remove predicates that</span><span>
</span><span id="line-1758"></span><span class="hs-comment">--</span><span>
</span><span id="line-1759"></span><span class="hs-comment">--   - are the same as another predicate</span><span>
</span><span id="line-1760"></span><span class="hs-comment">--</span><span>
</span><span id="line-1761"></span><span class="hs-comment">--   - can be deduced from another by superclasses,</span><span>
</span><span id="line-1762"></span><span class="hs-comment">--</span><span>
</span><span id="line-1763"></span><span class="hs-comment">--   - are a reflexive equality (e.g  * ~ *)</span><span>
</span><span id="line-1764"></span><span class="hs-comment">--     (see Note [Remove redundant provided dicts] in GHC.Tc.TyCl.PatSyn)</span><span>
</span><span id="line-1765"></span><span class="hs-comment">--</span><span>
</span><span id="line-1766"></span><span class="hs-comment">-- The result is a subset of the input.</span><span>
</span><span id="line-1767"></span><span class="hs-comment">-- The 'a' is just paired up with the PredType;</span><span>
</span><span id="line-1768"></span><span class="hs-comment">--   typically it might be a dictionary Id</span><span>
</span><span id="line-1769"></span><span id="mkMinimalBySCs"><span class="annot"><span class="annottext">mkMinimalBySCs :: forall a. (a -&gt; Type) -&gt; [a] -&gt; [a]
</span><a href="GHC.Tc.Utils.TcType.html#mkMinimalBySCs"><span class="hs-identifier hs-var hs-var">mkMinimalBySCs</span></a></span></span><span> </span><span id="local-6989586621680862017"><span class="annot"><span class="annottext">a -&gt; Type
</span><a href="#local-6989586621680862017"><span class="hs-identifier hs-var">get_pred</span></a></span></span><span> </span><span id="local-6989586621680862016"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680862016"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a] -&gt; [PredWithSCs a] -&gt; [a]
</span><a href="#local-6989586621680862015"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862014"><span class="hs-identifier hs-var">preds_with_scs</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1770"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1771"></span><span>   </span><span class="annot"><a href="#local-6989586621680862014"><span class="hs-identifier hs-type">preds_with_scs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#PredWithSCs"><span class="hs-identifier hs-type">PredWithSCs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680863242"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1772"></span><span>   </span><span id="local-6989586621680862014"><span class="annot"><span class="annottext">preds_with_scs :: [PredWithSCs a]
</span><a href="#local-6989586621680862014"><span class="hs-identifier hs-var hs-var">preds_with_scs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862013"><span class="hs-identifier hs-var">pred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862013"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; [Type]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type]
</span><a href="GHC.Tc.Utils.TcType.html#transSuperClasses"><span class="hs-identifier hs-var">transSuperClasses</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862013"><span class="hs-identifier hs-var">pred</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680862012"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1773"></span><span>                    </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621680862012"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680862012"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680862016"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1774"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680862013"><span class="annot"><span class="annottext">pred :: Type
</span><a href="#local-6989586621680862013"><span class="hs-identifier hs-var hs-var">pred</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Type
</span><a href="#local-6989586621680862017"><span class="hs-identifier hs-var">get_pred</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680862012"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1775"></span><span>
</span><span id="line-1776"></span><span>   </span><span class="annot"><a href="#local-6989586621680862015"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#PredWithSCs"><span class="hs-identifier hs-type">PredWithSCs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680863242"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>   </span><span class="hs-comment">-- Work list</span><span>
</span><span id="line-1777"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#PredWithSCs"><span class="hs-identifier hs-type">PredWithSCs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680863242"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>   </span><span class="hs-comment">-- Accumulating result</span><span>
</span><span id="line-1778"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680863242"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1779"></span><span>   </span><span id="local-6989586621680862015"><span class="annot"><span class="annottext">go :: [PredWithSCs a] -&gt; [PredWithSCs a] -&gt; [a]
</span><a href="#local-6989586621680862015"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621680862011"><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862011"><span class="hs-identifier hs-var">min_preds</span></a></span></span><span>
</span><span id="line-1780"></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(PredWithSCs a -&gt; a) -&gt; [PredWithSCs a] -&gt; [a]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">PredWithSCs a -&gt; a
forall a b c. (a, b, c) -&gt; c
</span><a href="GHC.Utils.Misc.html#thdOf3"><span class="hs-identifier hs-var">thdOf3</span></a></span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862011"><span class="hs-identifier hs-var">min_preds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1781"></span><span>       </span><span class="hs-comment">-- The 'reverse' isn't strictly necessary, but it</span><span>
</span><span id="line-1782"></span><span>       </span><span class="hs-comment">-- means that the results are returned in the same</span><span>
</span><span id="line-1783"></span><span>       </span><span class="hs-comment">-- order as the input, which is generally saner</span><span>
</span><span id="line-1784"></span><span>   </span><span class="annot"><a href="#local-6989586621680862015"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680862009"><span class="annot"><span class="annottext">work_item :: PredWithSCs a
</span><a href="#local-6989586621680862009"><span class="hs-identifier hs-var">work_item</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621680862008"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862008"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680862007"><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862007"><span class="hs-identifier hs-var">work_list</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680862006"><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862006"><span class="hs-identifier hs-var">min_preds</span></a></span></span><span>
</span><span id="line-1785"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqPred"><span class="hs-identifier hs-type">EqPred</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680862005"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862005"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621680862004"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862004"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Pred
</span><a href="GHC.Core.Predicate.html#classifyPredType"><span class="hs-identifier hs-var">classifyPredType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862008"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-1786"></span><span>     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862005"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Type -&gt; Bool
Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcEqType"><span class="hs-operator hs-var">`tcEqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862004"><span class="hs-identifier hs-var">t2</span></a></span><span>   </span><span class="hs-comment">-- See GHC.Tc.TyCl.PatSyn</span><span>
</span><span id="line-1787"></span><span>                          </span><span class="hs-comment">-- Note [Remove redundant provided dicts]</span><span>
</span><span id="line-1788"></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a] -&gt; [PredWithSCs a] -&gt; [a]
</span><a href="#local-6989586621680862015"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862007"><span class="hs-identifier hs-var">work_list</span></a></span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862006"><span class="hs-identifier hs-var">min_preds</span></a></span><span>
</span><span id="line-1789"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862008"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; [PredWithSCs a] -&gt; Bool
</span><a href="#local-6989586621680862003"><span class="hs-operator hs-var">`in_cloud`</span></a></span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862007"><span class="hs-identifier hs-var">work_list</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862008"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; [PredWithSCs a] -&gt; Bool
</span><a href="#local-6989586621680862003"><span class="hs-operator hs-var">`in_cloud`</span></a></span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862006"><span class="hs-identifier hs-var">min_preds</span></a></span><span>
</span><span id="line-1790"></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a] -&gt; [PredWithSCs a] -&gt; [a]
</span><a href="#local-6989586621680862015"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862007"><span class="hs-identifier hs-var">work_list</span></a></span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862006"><span class="hs-identifier hs-var">min_preds</span></a></span><span>
</span><span id="line-1791"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1792"></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a] -&gt; [PredWithSCs a] -&gt; [a]
</span><a href="#local-6989586621680862015"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862007"><span class="hs-identifier hs-var">work_list</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PredWithSCs a
</span><a href="#local-6989586621680862009"><span class="hs-identifier hs-var">work_item</span></a></span><span> </span><span class="annot"><span class="annottext">PredWithSCs a -&gt; [PredWithSCs a] -&gt; [PredWithSCs a]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862006"><span class="hs-identifier hs-var">min_preds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1793"></span><span>
</span><span id="line-1794"></span><span>   </span><span class="annot"><a href="#local-6989586621680862003"><span class="hs-identifier hs-type">in_cloud</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#PredWithSCs"><span class="hs-identifier hs-type">PredWithSCs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680863242"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1795"></span><span>   </span><span id="local-6989586621680862003"><span class="annot"><span class="annottext">in_cloud :: Type -&gt; [PredWithSCs a] -&gt; Bool
</span><a href="#local-6989586621680862003"><span class="hs-identifier hs-var hs-var">in_cloud</span></a></span></span><span> </span><span id="local-6989586621680862002"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862002"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621680862001"><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862001"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; Bool
forall (t :: * -&gt; *). Foldable t =&gt; t Bool -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#or"><span class="hs-identifier hs-var">or</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680862002"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Type -&gt; Bool
Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcEqType"><span class="hs-operator hs-var">`tcEqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861999"><span class="hs-identifier hs-var">p'</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680861998"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861998"><span class="hs-identifier hs-var">scs</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[PredWithSCs a]
</span><a href="#local-6989586621680862001"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680861999"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861999"><span class="hs-identifier hs-var">p'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861998"><span class="hs-identifier hs-var">scs</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1796"></span><span>
</span><span id="line-1797"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#transSuperClasses"><span class="hs-identifier hs-type">transSuperClasses</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1798"></span><span class="hs-comment">-- (transSuperClasses p) returns (p's superclasses) not including p</span><span>
</span><span id="line-1799"></span><span class="hs-comment">-- Stop if you encounter the same class again</span><span>
</span><span id="line-1800"></span><span class="hs-comment">-- See Note [Expanding superclasses]</span><span>
</span><span id="line-1801"></span><span id="transSuperClasses"><span class="annot"><span class="annottext">transSuperClasses :: Type -&gt; [Type]
</span><a href="GHC.Tc.Utils.TcType.html#transSuperClasses"><span class="hs-identifier hs-var hs-var">transSuperClasses</span></a></span></span><span> </span><span id="local-6989586621680861997"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861997"><span class="hs-identifier hs-var">p</span></a></span></span><span>
</span><span id="line-1802"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameSet -&gt; Type -&gt; [Type]
</span><a href="#local-6989586621680861996"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">NameSet
</span><a href="GHC.Types.Name.Set.html#emptyNameSet"><span class="hs-identifier hs-var">emptyNameSet</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861997"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-1803"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1804"></span><span>    </span><span class="annot"><a href="#local-6989586621680861996"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1805"></span><span>    </span><span id="local-6989586621680861996"><span class="annot"><span class="annottext">go :: NameSet -&gt; Type -&gt; [Type]
</span><a href="#local-6989586621680861996"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680861994"><span class="annot"><span class="annottext">NameSet
</span><a href="#local-6989586621680861994"><span class="hs-identifier hs-var">rec_clss</span></a></span></span><span> </span><span id="local-6989586621680861993"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861993"><span class="hs-identifier hs-var">p</span></a></span></span><span>
</span><span id="line-1806"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#ClassPred"><span class="hs-identifier hs-type">ClassPred</span></a></span><span> </span><span id="local-6989586621680861992"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680861992"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span id="local-6989586621680861991"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861991"><span class="hs-identifier hs-var">tys</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Pred
</span><a href="GHC.Core.Predicate.html#classifyPredType"><span class="hs-identifier hs-var">classifyPredType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861993"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-1807"></span><span>       </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680861990"><span class="annot"><span class="annottext">cls_nm :: Name
</span><a href="#local-6989586621680861990"><span class="hs-identifier hs-var hs-var">cls_nm</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Name
</span><a href="GHC.Core.Class.html#className"><span class="hs-identifier hs-var hs-var">className</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680861992"><span class="hs-identifier hs-var">cls</span></a></span><span>
</span><span id="line-1808"></span><span>       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680861990"><span class="hs-identifier hs-var">cls_nm</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; NameSet -&gt; Bool
</span><a href="GHC.Types.Name.Set.html#elemNameSet"><span class="hs-operator hs-var">`elemNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">NameSet
</span><a href="#local-6989586621680861994"><span class="hs-identifier hs-var">rec_clss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1809"></span><span>       </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680861987"><span class="annot"><span class="annottext">rec_clss' :: NameSet
</span><a href="#local-6989586621680861987"><span class="hs-identifier hs-var hs-var">rec_clss'</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isCTupleClass"><span class="hs-identifier hs-var">isCTupleClass</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680861992"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameSet
</span><a href="#local-6989586621680861994"><span class="hs-identifier hs-var">rec_clss</span></a></span><span>
</span><span id="line-1810"></span><span>                       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameSet
</span><a href="#local-6989586621680861994"><span class="hs-identifier hs-var">rec_clss</span></a></span><span> </span><span class="annot"><span class="annottext">NameSet -&gt; Name -&gt; NameSet
</span><a href="GHC.Types.Name.Set.html#extendNameSet"><span class="hs-operator hs-var">`extendNameSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621680861990"><span class="hs-identifier hs-var">cls_nm</span></a></span><span>
</span><span id="line-1811"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861984"><span class="hs-identifier hs-var">p'</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621680861983"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861983"><span class="hs-identifier hs-var">sc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Class -&gt; [Type] -&gt; [Type]
</span><a href="GHC.Tc.Utils.TcType.html#immSuperClasses"><span class="hs-identifier hs-var">immSuperClasses</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680861992"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861991"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-1812"></span><span>              </span><span class="hs-special">,</span><span> </span><span id="local-6989586621680861984"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861984"><span class="hs-identifier hs-var">p'</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861983"><span class="hs-identifier hs-var">sc</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; [Type]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">NameSet -&gt; Type -&gt; [Type]
</span><a href="#local-6989586621680861996"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">NameSet
</span><a href="#local-6989586621680861987"><span class="hs-identifier hs-var">rec_clss'</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861983"><span class="hs-identifier hs-var">sc</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1813"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1814"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1815"></span><span>
</span><span id="line-1816"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#immSuperClasses"><span class="hs-identifier hs-type">immSuperClasses</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1817"></span><span id="immSuperClasses"><span class="annot"><span class="annottext">immSuperClasses :: Class -&gt; [Type] -&gt; [Type]
</span><a href="GHC.Tc.Utils.TcType.html#immSuperClasses"><span class="hs-identifier hs-var hs-var">immSuperClasses</span></a></span></span><span> </span><span id="local-6989586621680861982"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680861982"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span id="local-6989586621680861981"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861981"><span class="hs-identifier hs-var">tys</span></a></span></span><span>
</span><span id="line-1818"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; TCvSubst -&gt; [Type] -&gt; [Type]
TCvSubst -&gt; [Type] -&gt; [Type]
</span><a href="GHC.Core.TyCo.Subst.html#substTheta"><span class="hs-identifier hs-var">substTheta</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TcTyVar] -&gt; [Type] -&gt; TCvSubst
HasDebugCallStack =&gt; [TcTyVar] -&gt; [Type] -&gt; TCvSubst
</span><a href="GHC.Core.TyCo.Subst.html#zipTvSubst"><span class="hs-identifier hs-var">zipTvSubst</span></a></span><span> </span><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680861980"><span class="hs-identifier hs-var">tyvars</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861981"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861979"><span class="hs-identifier hs-var">sc_theta</span></a></span><span>
</span><span id="line-1819"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1820"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680861980"><span class="annot"><span class="annottext">[TcTyVar]
</span><a href="#local-6989586621680861980"><span class="hs-identifier hs-var">tyvars</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680861979"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861979"><span class="hs-identifier hs-var">sc_theta</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[TcTyVar]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[ClassOpItem]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class -&gt; ([TcTyVar], [Type], [TcTyVar], [ClassOpItem])
</span><a href="GHC.Core.Class.html#classBigSig"><span class="hs-identifier hs-var">classBigSig</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680861982"><span class="hs-identifier hs-var">cls</span></a></span><span>
</span><span id="line-1821"></span><span>
</span><span id="line-1822"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isImprovementPred"><span class="hs-identifier hs-type">isImprovementPred</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#PredType"><span class="hs-identifier hs-type">PredType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1823"></span><span class="hs-comment">-- Either it's an equality, or has some functional dependency</span><span>
</span><span id="line-1824"></span><span id="isImprovementPred"><span class="annot"><span class="annottext">isImprovementPred :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isImprovementPred"><span class="hs-identifier hs-var hs-var">isImprovementPred</span></a></span></span><span> </span><span id="local-6989586621680861977"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861977"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1825"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Pred
</span><a href="GHC.Core.Predicate.html#classifyPredType"><span class="hs-identifier hs-var">classifyPredType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861977"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1826"></span><span>      </span><span class="annot"><a href="GHC.Core.Predicate.html#EqPred"><span class="hs-identifier hs-type">EqPred</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span> </span><span id="local-6989586621680861976"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861976"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621680861975"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861975"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861976"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Type -&gt; Bool
Type -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#tcEqType"><span class="hs-operator hs-var">`tcEqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861975"><span class="hs-identifier hs-var">t2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1827"></span><span>      </span><span class="annot"><a href="GHC.Core.Predicate.html#EqPred"><span class="hs-identifier hs-type">EqPred</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1828"></span><span>      </span><span class="annot"><a href="GHC.Core.Predicate.html#ClassPred"><span class="hs-identifier hs-type">ClassPred</span></a></span><span> </span><span id="local-6989586621680861974"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680861974"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Bool
</span><a href="GHC.Core.Class.html#classHasFds"><span class="hs-identifier hs-var">classHasFds</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680861974"><span class="hs-identifier hs-var">cls</span></a></span><span>
</span><span id="line-1829"></span><span>      </span><span class="annot"><a href="GHC.Core.Predicate.html#IrredPred"><span class="hs-identifier hs-type">IrredPred</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-comment">-- Might have equalities after reduction?</span><span>
</span><span id="line-1830"></span><span>      </span><span class="annot"><a href="GHC.Core.Predicate.html#ForAllPred"><span class="hs-identifier hs-type">ForAllPred</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1831"></span><span>
</span><span id="line-1832"></span><span class="hs-comment">-- | Is the equality</span><span>
</span><span id="line-1833"></span><span class="hs-comment">--        a ~r ...a....</span><span>
</span><span id="line-1834"></span><span class="hs-comment">-- definitely insoluble or not?</span><span>
</span><span id="line-1835"></span><span class="hs-comment">--      a ~r Maybe a      -- Definitely insoluble</span><span>
</span><span id="line-1836"></span><span class="hs-comment">--      a ~N ...(F a)...  -- Not definitely insoluble</span><span>
</span><span id="line-1837"></span><span class="hs-comment">--                        -- Perhaps (F a) reduces to Int</span><span>
</span><span id="line-1838"></span><span class="hs-comment">--      a ~R ...(N a)...  -- Not definitely insoluble</span><span>
</span><span id="line-1839"></span><span class="hs-comment">--                        -- Perhaps newtype N a = MkN Int</span><span>
</span><span id="line-1840"></span><span class="hs-comment">-- See Note [Occurs check error] in</span><span>
</span><span id="line-1841"></span><span class="hs-comment">-- &quot;GHC.Tc.Solver.Canonical&quot; for the motivation for this function.</span><span>
</span><span id="line-1842"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isInsolubleOccursCheck"><span class="hs-identifier hs-type">isInsolubleOccursCheck</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Predicate.html#EqRel"><span class="hs-identifier hs-type">EqRel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1843"></span><span id="isInsolubleOccursCheck"><span class="annot"><span class="annottext">isInsolubleOccursCheck :: EqRel -&gt; TcTyVar -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isInsolubleOccursCheck"><span class="hs-identifier hs-var hs-var">isInsolubleOccursCheck</span></a></span></span><span> </span><span id="local-6989586621680861971"><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680861971"><span class="hs-identifier hs-var">eq_rel</span></a></span></span><span> </span><span id="local-6989586621680861970"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861970"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span id="local-6989586621680861969"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861969"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1844"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861969"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1845"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1846"></span><span>    </span><span id="local-6989586621680861968"><span class="annot"><span class="annottext">go :: Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680861963"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861963"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680861962"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861962"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861963"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861962"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-1847"></span><span>    </span><span class="annot"><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span id="local-6989586621680861961"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861961"><span class="hs-identifier hs-var">tv'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861970"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVar -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861961"><span class="hs-identifier hs-var">tv'</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar -&gt; Type
</span><a href="GHC.Types.Var.html#tyVarKind"><span class="hs-identifier hs-var">tyVarKind</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861961"><span class="hs-identifier hs-var">tv'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1848"></span><span>    </span><span class="annot"><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LitTy"><span class="hs-identifier hs-type">LitTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1849"></span><span>    </span><span class="annot"><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppTy"><span class="hs-identifier hs-type">AppTy</span></a></span><span> </span><span id="local-6989586621680861960"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861960"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621680861959"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861959"><span class="hs-identifier hs-var">t2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680861971"><span class="hs-identifier hs-var">eq_rel</span></a></span><span> </span><span class="hs-keyword">of</span><span>  </span><span class="hs-comment">-- See Note [AppTy and ReprEq]</span><span>
</span><span id="line-1850"></span><span>                         </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#NomEq"><span class="hs-identifier hs-var">NomEq</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861960"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861959"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1851"></span><span>                         </span><span class="annot"><span class="annottext">EqRel
</span><a href="GHC.Core.Predicate.html#ReprEq"><span class="hs-identifier hs-var">ReprEq</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861960"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-1852"></span><span>    </span><span class="annot"><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680861958"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861958"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621680861957"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861957"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621680861956"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861956"><span class="hs-identifier hs-var">t2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861958"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861957"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861956"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1853"></span><span>    </span><span class="annot"><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Bndr"><span class="hs-identifier hs-type">Bndr</span></a></span><span> </span><span id="local-6989586621680861955"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861955"><span class="hs-identifier hs-var">tv'</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgFlag
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680861954"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861954"><span class="hs-identifier hs-var">inner_ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1854"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861955"><span class="hs-identifier hs-var">tv'</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVar -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861970"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1855"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar -&gt; Type
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861955"><span class="hs-identifier hs-var">tv'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861954"><span class="hs-identifier hs-var">inner_ty</span></a></span><span>
</span><span id="line-1856"></span><span>    </span><span class="annot"><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span> </span><span id="local-6989586621680861953"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861953"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861953"><span class="hs-identifier hs-var">ty</span></a></span><span>   </span><span class="hs-comment">-- ToDo: what about the coercion</span><span>
</span><span id="line-1857"></span><span>    </span><span class="annot"><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>   </span><span class="hs-comment">-- ToDo: what about the coercion</span><span>
</span><span id="line-1858"></span><span>    </span><span class="annot"><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConApp"><span class="hs-identifier hs-type">TyConApp</span></a></span><span> </span><span id="local-6989586621680861952"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861952"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680861951"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861951"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1859"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Role -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isGenerativeTyCon"><span class="hs-identifier hs-var">isGenerativeTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861952"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="#local-6989586621680861949"><span class="hs-keyword hs-var">role</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Bool) -&gt; [Type] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861951"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-1860"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Bool) -&gt; [Type] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621680861968"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Arity -&gt; [Type] -&gt; [Type]
forall a. Arity -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#drop"><span class="hs-identifier hs-var">drop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Arity
</span><a href="GHC.Core.TyCon.html#tyConArity"><span class="hs-identifier hs-var hs-var">tyConArity</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861952"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861951"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1861"></span><span>         </span><span class="hs-comment">-- (a ~ F b a), where F has arity 1,</span><span>
</span><span id="line-1862"></span><span>         </span><span class="hs-comment">-- has an insoluble occurs check</span><span>
</span><span id="line-1863"></span><span>
</span><span id="line-1864"></span><span>    </span><span id="local-6989586621680861949"><span class="annot"><span class="annottext">role :: Role
</span><a href="#local-6989586621680861949"><span class="hs-keyword hs-var hs-var">role</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">EqRel -&gt; Role
</span><a href="GHC.Core.Predicate.html#eqRelRole"><span class="hs-identifier hs-var">eqRelRole</span></a></span><span> </span><span class="annot"><span class="annottext">EqRel
</span><a href="#local-6989586621680861971"><span class="hs-identifier hs-var">eq_rel</span></a></span><span>
</span><span id="line-1865"></span><span>
</span><span id="line-1866"></span><span class="hs-comment">{- Note [Expanding superclasses]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When we expand superclasses, we use the following algorithm:

transSuperClasses( C tys ) returns the transitive superclasses
                           of (C tys), not including C itself

For example
  class C a b =&gt; D a b
  class D b a =&gt; C a b

Then
  transSuperClasses( Ord ty )  = [Eq ty]
  transSuperClasses( C ta tb ) = [D tb ta, C tb ta]

Notice that in the recursive-superclass case we include C again at
the end of the chain.  One could exclude C in this case, but
the code is more awkward and there seems no good reason to do so.
(However C.f. GHC.Tc.Solver.Canonical.mk_strict_superclasses, which /does/
appear to do so.)

The algorithm is expand( so_far, pred ):

 1. If pred is not a class constraint, return empty set
       Otherwise pred = C ts
 2. If C is in so_far, return empty set (breaks loops)
 3. Find the immediate superclasses constraints of (C ts)
 4. For each such sc_pred, return (sc_pred : expand( so_far+C, D ss )

Notice that

 * With normal Haskell-98 classes, the loop-detector will never bite,
   so we'll get all the superclasses.

 * We need the loop-breaker in case we have UndecidableSuperClasses on

 * Since there is only a finite number of distinct classes, expansion
   must terminate.

 * The loop breaking is a bit conservative. Notably, a tuple class
   could contain many times without threatening termination:
      (Eq a, (Ord a, Ix a))
   And this is try of any class that we can statically guarantee
   as non-recursive (in some sense).  For now, we just make a special
   case for tuples.  Something better would be cool.

See also GHC.Tc.TyCl.Utils.checkClassCycles.

Note [Lift equality constraints when quantifying]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We can't quantify over a constraint (t1 ~# t2) because that isn't a
predicate type; see Note [Types for coercions, predicates, and evidence]
in GHC.Core.TyCo.Rep.

So we have to 'lift' it to (t1 ~ t2).  Similarly (~R#) must be lifted
to Coercible.

This tiresome lifting is the reason that pick_me (in
pickQuantifiablePreds) returns a Maybe rather than a Bool.

Note [Quantifying over equality constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Should we quantify over an equality constraint (s ~ t)?  In general, we don't.
Doing so may simply postpone a type error from the function definition site to
its call site.  (At worst, imagine (Int ~ Bool)).

However, consider this
         forall a. (F [a] ~ Int) =&gt; blah
Should we quantify over the (F [a] ~ Int)?  Perhaps yes, because at the call
site we will know 'a', and perhaps we have instance  F [Bool] = Int.
So we *do* quantify over a type-family equality where the arguments mention
the quantified variables.

Note [Inheriting implicit parameters]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider this:

        f x = (x::Int) + ?y

where f is *not* a top-level binding.
From the RHS of f we'll get the constraint (?y::Int).
There are two types we might infer for f:

        f :: Int -&gt; Int

(so we get ?y from the context of f's definition), or

        f :: (?y::Int) =&gt; Int -&gt; Int

At first you might think the first was better, because then
?y behaves like a free variable of the definition, rather than
having to be passed at each call site.  But of course, the WHOLE
IDEA is that ?y should be passed at each call site (that's what
dynamic binding means) so we'd better infer the second.

BOTTOM LINE: when *inferring types* you must quantify over implicit
parameters, *even if* they don't mention the bound type variables.
Reason: because implicit parameters, uniquely, have local instance
declarations. See pickQuantifiablePreds.

Note [Quantifying over equality constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Should we quantify over an equality constraint (s ~ t)?  In general, we don't.
Doing so may simply postpone a type error from the function definition site to
its call site.  (At worst, imagine (Int ~ Bool)).

However, consider this
         forall a. (F [a] ~ Int) =&gt; blah
Should we quantify over the (F [a] ~ Int).  Perhaps yes, because at the call
site we will know 'a', and perhaps we have instance  F [Bool] = Int.
So we *do* quantify over a type-family equality where the arguments mention
the quantified variables.

************************************************************************
*                                                                      *
      Classifying types
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-1985"></span><span>
</span><span id="line-1986"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isSigmaTy"><span class="hs-identifier hs-type">isSigmaTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1987"></span><span class="hs-comment">-- isSigmaTy returns true of any qualified type.  It doesn't</span><span>
</span><span id="line-1988"></span><span class="hs-comment">-- *necessarily* have any foralls.  E.g</span><span>
</span><span id="line-1989"></span><span class="hs-comment">--        f :: (?x::Int) =&gt; Int -&gt; Int</span><span>
</span><span id="line-1990"></span><span id="isSigmaTy"><span class="annot"><span class="annottext">isSigmaTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isSigmaTy"><span class="hs-identifier hs-var hs-var">isSigmaTy</span></a></span></span><span> </span><span id="local-6989586621680861946"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861946"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680861945"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861945"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861946"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isSigmaTy"><span class="hs-identifier hs-var">isSigmaTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861945"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-1991"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isSigmaTy"><span class="hs-identifier hs-var">isSigmaTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1992"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isSigmaTy"><span class="hs-identifier hs-var">isSigmaTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ft_af :: Type -&gt; AnonArgFlag
</span><a href="GHC.Core.TyCo.Rep.html#ft_af"><span class="hs-identifier hs-var">ft_af</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><a href="GHC.Types.Var.html#InvisArg"><span class="hs-identifier hs-var">InvisArg</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1993"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isSigmaTy"><span class="hs-identifier hs-var">isSigmaTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>                            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1994"></span><span>
</span><span id="line-1995"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isRhoTy"><span class="hs-identifier hs-type">isRhoTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>   </span><span class="hs-comment">-- True of TcRhoTypes; see Note [TcRhoType]</span><span>
</span><span id="line-1996"></span><span id="isRhoTy"><span class="annot"><span class="annottext">isRhoTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isRhoTy"><span class="hs-identifier hs-var hs-var">isRhoTy</span></a></span></span><span> </span><span id="local-6989586621680861944"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861944"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680861943"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861943"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861944"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isRhoTy"><span class="hs-identifier hs-var">isRhoTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861943"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-1997"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isRhoTy"><span class="hs-identifier hs-var">isRhoTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1998"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isRhoTy"><span class="hs-identifier hs-var">isRhoTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ft_af :: Type -&gt; AnonArgFlag
</span><a href="GHC.Core.TyCo.Rep.html#ft_af"><span class="hs-identifier hs-var">ft_af</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><a href="GHC.Types.Var.html#InvisArg"><span class="hs-identifier hs-var">InvisArg</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1999"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isRhoTy"><span class="hs-identifier hs-var">isRhoTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>                            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-2000"></span><span>
</span><span id="line-2001"></span><span class="hs-comment">-- | Like 'isRhoTy', but also says 'True' for 'Infer' types</span><span>
</span><span id="line-2002"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isRhoExpTy"><span class="hs-identifier hs-type">isRhoExpTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#ExpType"><span class="hs-identifier hs-type">ExpType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2003"></span><span id="isRhoExpTy"><span class="annot"><span class="annottext">isRhoExpTy :: ExpType -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isRhoExpTy"><span class="hs-identifier hs-var hs-var">isRhoExpTy</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Check"><span class="hs-identifier hs-type">Check</span></a></span><span> </span><span id="local-6989586621680861942"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861942"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isRhoTy"><span class="hs-identifier hs-var">isRhoTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861942"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2004"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isRhoExpTy"><span class="hs-identifier hs-var">isRhoExpTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#Infer"><span class="hs-identifier hs-type">Infer</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-2005"></span><span>
</span><span id="line-2006"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isOverloadedTy"><span class="hs-identifier hs-type">isOverloadedTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2007"></span><span class="hs-comment">-- Yes for a type of a function that might require evidence-passing</span><span>
</span><span id="line-2008"></span><span class="hs-comment">-- Used only by bindLocalMethods</span><span>
</span><span id="line-2009"></span><span id="isOverloadedTy"><span class="annot"><span class="annottext">isOverloadedTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isOverloadedTy"><span class="hs-identifier hs-var hs-var">isOverloadedTy</span></a></span></span><span> </span><span id="local-6989586621680861941"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861941"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680861940"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861940"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861941"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isOverloadedTy"><span class="hs-identifier hs-var">isOverloadedTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861940"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-2010"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isOverloadedTy"><span class="hs-identifier hs-var">isOverloadedTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVarBinder
</span><span class="hs-identifier">_</span></span><span>  </span><span id="local-6989586621680861939"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861939"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isOverloadedTy"><span class="hs-identifier hs-var">isOverloadedTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861939"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2011"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isOverloadedTy"><span class="hs-identifier hs-var">isOverloadedTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ft_af :: Type -&gt; AnonArgFlag
</span><a href="GHC.Core.TyCo.Rep.html#ft_af"><span class="hs-identifier hs-var">ft_af</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><a href="GHC.Types.Var.html#InvisArg"><span class="hs-identifier hs-var">InvisArg</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-2012"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isOverloadedTy"><span class="hs-identifier hs-var">isOverloadedTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>                            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-2013"></span><span>
</span><span id="line-2014"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFloatTy"><span class="hs-identifier hs-type">isFloatTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isDoubleTy"><span class="hs-identifier hs-type">isDoubleTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isIntegerTy"><span class="hs-identifier hs-type">isIntegerTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isNaturalTy"><span class="hs-identifier hs-type">isNaturalTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-2015"></span><span>    </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isIntTy"><span class="hs-identifier hs-type">isIntTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isWordTy"><span class="hs-identifier hs-type">isWordTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isBoolTy"><span class="hs-identifier hs-type">isBoolTy</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-2016"></span><span>    </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isUnitTy"><span class="hs-identifier hs-type">isUnitTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isCharTy"><span class="hs-identifier hs-type">isCharTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isAnyTy"><span class="hs-identifier hs-type">isAnyTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2017"></span><span id="isFloatTy"><span class="annot"><span class="annottext">isFloatTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFloatTy"><span class="hs-identifier hs-var hs-var">isFloatTy</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unique -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#is_tc"><span class="hs-identifier hs-var">is_tc</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#floatTyConKey"><span class="hs-identifier hs-var">floatTyConKey</span></a></span><span>
</span><span id="line-2018"></span><span id="isDoubleTy"><span class="annot"><span class="annottext">isDoubleTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isDoubleTy"><span class="hs-identifier hs-var hs-var">isDoubleTy</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unique -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#is_tc"><span class="hs-identifier hs-var">is_tc</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#doubleTyConKey"><span class="hs-identifier hs-var">doubleTyConKey</span></a></span><span>
</span><span id="line-2019"></span><span id="isIntegerTy"><span class="annot"><span class="annottext">isIntegerTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isIntegerTy"><span class="hs-identifier hs-var hs-var">isIntegerTy</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unique -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#is_tc"><span class="hs-identifier hs-var">is_tc</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#integerTyConKey"><span class="hs-identifier hs-var">integerTyConKey</span></a></span><span>
</span><span id="line-2020"></span><span id="isNaturalTy"><span class="annot"><span class="annottext">isNaturalTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isNaturalTy"><span class="hs-identifier hs-var hs-var">isNaturalTy</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unique -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#is_tc"><span class="hs-identifier hs-var">is_tc</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#naturalTyConKey"><span class="hs-identifier hs-var">naturalTyConKey</span></a></span><span>
</span><span id="line-2021"></span><span id="isIntTy"><span class="annot"><span class="annottext">isIntTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isIntTy"><span class="hs-identifier hs-var hs-var">isIntTy</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unique -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#is_tc"><span class="hs-identifier hs-var">is_tc</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#intTyConKey"><span class="hs-identifier hs-var">intTyConKey</span></a></span><span>
</span><span id="line-2022"></span><span id="isWordTy"><span class="annot"><span class="annottext">isWordTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isWordTy"><span class="hs-identifier hs-var hs-var">isWordTy</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unique -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#is_tc"><span class="hs-identifier hs-var">is_tc</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#wordTyConKey"><span class="hs-identifier hs-var">wordTyConKey</span></a></span><span>
</span><span id="line-2023"></span><span id="isBoolTy"><span class="annot"><span class="annottext">isBoolTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isBoolTy"><span class="hs-identifier hs-var hs-var">isBoolTy</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unique -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#is_tc"><span class="hs-identifier hs-var">is_tc</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#boolTyConKey"><span class="hs-identifier hs-var">boolTyConKey</span></a></span><span>
</span><span id="line-2024"></span><span id="isUnitTy"><span class="annot"><span class="annottext">isUnitTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isUnitTy"><span class="hs-identifier hs-var hs-var">isUnitTy</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unique -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#is_tc"><span class="hs-identifier hs-var">is_tc</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Types.html#unitTyConKey"><span class="hs-identifier hs-var">unitTyConKey</span></a></span><span>
</span><span id="line-2025"></span><span id="isCharTy"><span class="annot"><span class="annottext">isCharTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isCharTy"><span class="hs-identifier hs-var hs-var">isCharTy</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unique -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#is_tc"><span class="hs-identifier hs-var">is_tc</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#charTyConKey"><span class="hs-identifier hs-var">charTyConKey</span></a></span><span>
</span><span id="line-2026"></span><span id="isAnyTy"><span class="annot"><span class="annottext">isAnyTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAnyTy"><span class="hs-identifier hs-var hs-var">isAnyTy</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unique -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#is_tc"><span class="hs-identifier hs-var">is_tc</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#anyTyConKey"><span class="hs-identifier hs-var">anyTyConKey</span></a></span><span>
</span><span id="line-2027"></span><span>
</span><span id="line-2028"></span><span class="hs-comment">-- | Does a type represent a floating-point number?</span><span>
</span><span id="line-2029"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFloatingTy"><span class="hs-identifier hs-type">isFloatingTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2030"></span><span id="isFloatingTy"><span class="annot"><span class="annottext">isFloatingTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFloatingTy"><span class="hs-identifier hs-var hs-var">isFloatingTy</span></a></span></span><span> </span><span id="local-6989586621680861927"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861927"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFloatTy"><span class="hs-identifier hs-var">isFloatTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861927"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isDoubleTy"><span class="hs-identifier hs-var">isDoubleTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861927"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2031"></span><span>
</span><span id="line-2032"></span><span class="hs-comment">-- | Is a type 'String'?</span><span>
</span><span id="line-2033"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isStringTy"><span class="hs-identifier hs-type">isStringTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2034"></span><span id="isStringTy"><span class="annot"><span class="annottext">isStringTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isStringTy"><span class="hs-identifier hs-var hs-var">isStringTy</span></a></span></span><span> </span><span id="local-6989586621680861926"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861926"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-2035"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#tcSplitTyConApp_maybe"><span class="hs-identifier hs-var">tcSplitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861926"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-2036"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680861925"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861925"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span id="local-6989586621680861924"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861924"><span class="hs-identifier hs-var">arg_ty</span></a></span></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861925"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; TyCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#listTyCon"><span class="hs-identifier hs-var">listTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isCharTy"><span class="hs-identifier hs-var">isCharTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861924"><span class="hs-identifier hs-var">arg_ty</span></a></span><span>
</span><span id="line-2037"></span><span>      </span><span class="annot"><span class="annottext">Maybe (TyCon, [Type])
</span><span class="hs-identifier">_</span></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-2038"></span><span>
</span><span id="line-2039"></span><span class="hs-comment">-- | Is a type a 'CallStack'?</span><span>
</span><span id="line-2040"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isCallStackTy"><span class="hs-identifier hs-type">isCallStackTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2041"></span><span id="isCallStackTy"><span class="annot"><span class="annottext">isCallStackTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isCallStackTy"><span class="hs-identifier hs-var hs-var">isCallStackTy</span></a></span></span><span> </span><span id="local-6989586621680861923"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861923"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-2042"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680861922"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861922"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe TyCon
</span><a href="GHC.Core.Type.html#tyConAppTyCon_maybe"><span class="hs-identifier hs-var">tyConAppTyCon_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861923"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2043"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861922"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#callStackTyConKey"><span class="hs-identifier hs-var">callStackTyConKey</span></a></span><span>
</span><span id="line-2044"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-2045"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-2046"></span><span>
</span><span id="line-2047"></span><span class="hs-comment">-- | Is a 'PredType' a 'CallStack' implicit parameter?</span><span>
</span><span id="line-2048"></span><span class="hs-comment">--</span><span>
</span><span id="line-2049"></span><span class="hs-comment">-- If so, return the name of the parameter.</span><span>
</span><span id="line-2050"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isCallStackPred"><span class="hs-identifier hs-type">isCallStackPred</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Class.html#Class"><span class="hs-identifier hs-type">Class</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier hs-type">FastString</span></a></span><span>
</span><span id="line-2051"></span><span id="isCallStackPred"><span class="annot"><span class="annottext">isCallStackPred :: Class -&gt; [Type] -&gt; Maybe FastString
</span><a href="GHC.Tc.Utils.TcType.html#isCallStackPred"><span class="hs-identifier hs-var hs-var">isCallStackPred</span></a></span></span><span> </span><span id="local-6989586621680861918"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680861918"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span id="local-6989586621680861917"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861917"><span class="hs-identifier hs-var">tys</span></a></span></span><span>
</span><span id="line-2052"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">[</span><span id="local-6989586621680861916"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861916"><span class="hs-identifier hs-var">ty1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680861915"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861915"><span class="hs-identifier hs-var">ty2</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861917"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-2053"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Class -&gt; Bool
</span><a href="GHC.Core.Predicate.html#isIPClass"><span class="hs-identifier hs-var">isIPClass</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621680861918"><span class="hs-identifier hs-var">cls</span></a></span><span>
</span><span id="line-2054"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isCallStackTy"><span class="hs-identifier hs-var">isCallStackTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861915"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-2055"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe FastString
</span><a href="GHC.Core.Type.html#isStrLitTy"><span class="hs-identifier hs-var">isStrLitTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861916"><span class="hs-identifier hs-var">ty1</span></a></span><span>
</span><span id="line-2056"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-2057"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe FastString
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-2058"></span><span>
</span><span id="line-2059"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#is_tc"><span class="hs-identifier hs-type">is_tc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2060"></span><span class="hs-comment">-- Newtypes are opaque to this</span><span>
</span><span id="line-2061"></span><span id="is_tc"><span class="annot"><span class="annottext">is_tc :: Unique -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#is_tc"><span class="hs-identifier hs-var hs-var">is_tc</span></a></span></span><span> </span><span id="local-6989586621680861913"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621680861913"><span class="hs-identifier hs-var">uniq</span></a></span></span><span> </span><span id="local-6989586621680861912"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861912"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#tcSplitTyConApp_maybe"><span class="hs-identifier hs-var">tcSplitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861912"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-2062"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680861911"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861911"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621680861913"><span class="hs-identifier hs-var">uniq</span></a></span><span> </span><span class="annot"><span class="annottext">Unique -&gt; Unique -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique
forall a. Uniquable a =&gt; a -&gt; Unique
</span><a href="GHC.Types.Unique.html#getUnique"><span class="hs-identifier hs-var">getUnique</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861911"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-2063"></span><span>                        </span><span class="annot"><span class="annottext">Maybe (TyCon, [Type])
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-2064"></span><span>
</span><span id="line-2065"></span><span class="hs-comment">-- | Does the given tyvar appear at the head of a chain of applications</span><span>
</span><span id="line-2066"></span><span class="hs-comment">--     (a t1 ... tn)</span><span>
</span><span id="line-2067"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyVarHead"><span class="hs-identifier hs-type">isTyVarHead</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2068"></span><span id="isTyVarHead"><span class="annot"><span class="annottext">isTyVarHead :: TcTyVar -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isTyVarHead"><span class="hs-identifier hs-var hs-var">isTyVarHead</span></a></span></span><span> </span><span id="local-6989586621680861909"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861909"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span id="local-6989586621680861908"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861908"><span class="hs-identifier hs-var">tv'</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861909"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; TcTyVar -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861908"><span class="hs-identifier hs-var">tv'</span></a></span><span>
</span><span id="line-2069"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyVarHead"><span class="hs-identifier hs-var">isTyVarHead</span></a></span><span> </span><span id="local-6989586621680861907"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861907"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppTy"><span class="hs-identifier hs-type">AppTy</span></a></span><span> </span><span id="local-6989586621680861906"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861906"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isTyVarHead"><span class="hs-identifier hs-var">isTyVarHead</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861907"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861906"><span class="hs-identifier hs-var">fun</span></a></span><span>
</span><span id="line-2070"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyVarHead"><span class="hs-identifier hs-var">isTyVarHead</span></a></span><span> </span><span id="local-6989586621680861905"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861905"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span> </span><span id="local-6989586621680861904"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861904"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVar -&gt; Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isTyVarHead"><span class="hs-identifier hs-var">isTyVarHead</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861905"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861904"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2071"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyVarHead"><span class="hs-identifier hs-var">isTyVarHead</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConApp"><span class="hs-identifier hs-type">TyConApp</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-2072"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyVarHead"><span class="hs-identifier hs-var">isTyVarHead</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LitTy"><span class="hs-identifier hs-type">LitTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-2073"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyVarHead"><span class="hs-identifier hs-var">isTyVarHead</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-2074"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyVarHead"><span class="hs-identifier hs-var">isTyVarHead</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-2075"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isTyVarHead"><span class="hs-identifier hs-var">isTyVarHead</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-2076"></span><span>
</span><span id="line-2077"></span><span>
</span><span id="line-2078"></span><span class="hs-comment">{- Note [AppTy and ReprEq]
~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider   a ~R# b a
           a ~R# a b

The former is /not/ a definite error; we might instantiate 'b' with Id
   newtype Id a = MkId a
but the latter /is/ a definite error.

On the other hand, with nominal equality, both are definite errors
-}</span><span>
</span><span id="line-2089"></span><span>
</span><span id="line-2090"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isRigidTy"><span class="hs-identifier hs-type">isRigidTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2091"></span><span id="isRigidTy"><span class="annot"><span class="annottext">isRigidTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isRigidTy"><span class="hs-identifier hs-var hs-var">isRigidTy</span></a></span></span><span> </span><span id="local-6989586621680861903"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861903"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-2092"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680861902"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861902"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#tcSplitTyConApp_maybe"><span class="hs-identifier hs-var">tcSplitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861903"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Role -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isGenerativeTyCon"><span class="hs-identifier hs-var">isGenerativeTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861902"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span>
</span><span id="line-2093"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTy_maybe"><span class="hs-identifier hs-var">tcSplitAppTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861903"><span class="hs-identifier hs-var">ty</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-2094"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isForAllTy"><span class="hs-identifier hs-var">isForAllTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861903"><span class="hs-identifier hs-var">ty</span></a></span><span>                           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-2095"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-2096"></span><span>
</span><span id="line-2097"></span><span>
</span><span id="line-2098"></span><span class="hs-comment">-- | Is this type *almost function-free*? See Note [Almost function-free]</span><span>
</span><span id="line-2099"></span><span class="hs-comment">-- in &quot;GHC.Tc.Types&quot;</span><span>
</span><span id="line-2100"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-type">isAlmostFunctionFree</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2101"></span><span id="isAlmostFunctionFree"><span class="annot"><span class="annottext">isAlmostFunctionFree :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var hs-var">isAlmostFunctionFree</span></a></span></span><span> </span><span id="local-6989586621680861900"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861900"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680861899"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861899"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861900"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861899"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-2102"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-2103"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppTy"><span class="hs-identifier hs-type">AppTy</span></a></span><span> </span><span id="local-6989586621680861898"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861898"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680861897"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861897"><span class="hs-identifier hs-var">ty2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861898"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-2104"></span><span>                                       </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861897"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-2105"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConApp"><span class="hs-identifier hs-type">TyConApp</span></a></span><span> </span><span id="local-6989586621680861896"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861896"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680861895"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861895"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-2106"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isTypeFamilyTyCon"><span class="hs-identifier hs-var">isTypeFamilyTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861896"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-2107"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Bool) -&gt; [Type] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861895"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-2108"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span id="local-6989586621680861894"><span class="annot"><span class="annottext">TyCoVarBinder
</span><a href="#local-6989586621680861894"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCoVarBinder -&gt; Type
forall argf. VarBndr TcTyVar argf -&gt; Type
</span><a href="GHC.Types.Var.html#binderType"><span class="hs-identifier hs-var">binderType</span></a></span><span> </span><span class="annot"><span class="annottext">TyCoVarBinder
</span><a href="#local-6989586621680861894"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-2109"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680861893"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861893"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621680861892"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861892"><span class="hs-identifier hs-var">ty1</span></a></span></span><span> </span><span id="local-6989586621680861891"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861891"><span class="hs-identifier hs-var">ty2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861893"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-2110"></span><span>                                           </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861892"><span class="hs-identifier hs-var">ty1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span>
</span><span id="line-2111"></span><span>                                           </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861891"><span class="hs-identifier hs-var">ty2</span></a></span><span>
</span><span id="line-2112"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LitTy"><span class="hs-identifier hs-type">LitTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-2113"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span> </span><span id="local-6989586621680861890"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861890"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861890"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2114"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isAlmostFunctionFree"><span class="hs-identifier hs-var">isAlmostFunctionFree</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-2115"></span><span>
</span><span id="line-2116"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
   Misc
*                                                                      *
************************************************************************

Note [Visible type application]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GHC implements a generalisation of the algorithm described in the
&quot;Visible Type Application&quot; paper (available from
http://www.cis.upenn.edu/~sweirich/publications.html). A key part
of that algorithm is to distinguish user-specified variables from inferred
variables. For example, the following should typecheck:

  f :: forall a b. a -&gt; b -&gt; b
  f = const id

  g = const id

  x = f @Int @Bool 5 False
  y = g 5 @Bool False

The idea is that we wish to allow visible type application when we are
instantiating a specified, fixed variable. In practice, specified, fixed
variables are either written in a type signature (or
annotation), OR are imported from another module. (We could do better here,
for example by doing SCC analysis on parts of a module and considering any
type from outside one's SCC to be fully specified, but this is very confusing to
users. The simple rule above is much more straightforward and predictable.)

So, both of f's quantified variables are specified and may be instantiated.
But g has no type signature, so only id's variable is specified (because id
is imported). We write the type of g as forall {a}. a -&gt; forall b. b -&gt; b.
Note that the a is in braces, meaning it cannot be instantiated with
visible type application.

Tracking specified vs. inferred variables is done conveniently by a field
in TyBinder.

-}</span><span>
</span><span id="line-2157"></span><span>
</span><span id="line-2158"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#deNoteType"><span class="hs-identifier hs-type">deNoteType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-2159"></span><span class="hs-comment">-- Remove all *outermost* type synonyms and other notes</span><span>
</span><span id="line-2160"></span><span id="deNoteType"><span class="annot"><span class="annottext">deNoteType :: Type -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#deNoteType"><span class="hs-identifier hs-var hs-var">deNoteType</span></a></span></span><span> </span><span id="local-6989586621680861889"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861889"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680861888"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861888"><span class="hs-identifier hs-var">ty'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#coreView"><span class="hs-identifier hs-var">coreView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861889"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#deNoteType"><span class="hs-identifier hs-var">deNoteType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861888"><span class="hs-identifier hs-var">ty'</span></a></span><span>
</span><span id="line-2161"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#deNoteType"><span class="hs-identifier hs-var">deNoteType</span></a></span><span> </span><span id="local-6989586621680861887"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861887"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861887"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2162"></span><span>
</span><span id="line-2163"></span><span class="hs-comment">{-
Find the free tycons and classes of a type.  This is used in the front
end of the compiler.
-}</span><span>
</span><span id="line-2167"></span><span>
</span><span id="line-2168"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
   External types
*                                                                      *
************************************************************************

The compiler's foreign function interface supports the passing of a
restricted set of types as arguments and results (the restricting factor
being the )
-}</span><span>
</span><span id="line-2179"></span><span>
</span><span id="line-2180"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcSplitIOType_maybe"><span class="hs-identifier hs-type">tcSplitIOType_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-2181"></span><span class="hs-comment">-- (tcSplitIOType_maybe t) returns Just (IO,t',co)</span><span>
</span><span id="line-2182"></span><span class="hs-comment">--              if co : t ~ IO t'</span><span>
</span><span id="line-2183"></span><span class="hs-comment">--              returns Nothing otherwise</span><span>
</span><span id="line-2184"></span><span id="tcSplitIOType_maybe"><span class="annot"><span class="annottext">tcSplitIOType_maybe :: Type -&gt; Maybe (TyCon, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitIOType_maybe"><span class="hs-identifier hs-var hs-var">tcSplitIOType_maybe</span></a></span></span><span> </span><span id="local-6989586621680861886"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861886"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-2185"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#tcSplitTyConApp_maybe"><span class="hs-identifier hs-var">tcSplitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861886"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-2186"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680861885"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861885"><span class="hs-identifier hs-var">io_tycon</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span id="local-6989586621680861884"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861884"><span class="hs-identifier hs-var">io_res_ty</span></a></span></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-2187"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861885"><span class="hs-identifier hs-var">io_tycon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#ioTyConKey"><span class="hs-identifier hs-var">ioTyConKey</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-2188"></span><span>            </span><span class="annot"><span class="annottext">(TyCon, Type) -&gt; Maybe (TyCon, Type)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861885"><span class="hs-identifier hs-var">io_tycon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861884"><span class="hs-identifier hs-var">io_res_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-2189"></span><span>        </span><span class="annot"><span class="annottext">Maybe (TyCon, [Type])
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-2190"></span><span>            </span><span class="annot"><span class="annottext">Maybe (TyCon, Type)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-2191"></span><span>
</span><span id="line-2192"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFITy"><span class="hs-identifier hs-type">isFFITy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2193"></span><span class="hs-comment">-- True for any TyCon that can possibly be an arg or result of an FFI call</span><span>
</span><span id="line-2194"></span><span id="isFFITy"><span class="annot"><span class="annottext">isFFITy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFFITy"><span class="hs-identifier hs-var hs-var">isFFITy</span></a></span></span><span> </span><span id="local-6989586621680861882"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861882"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Validity -&gt; Bool
</span><a href="GHC.Utils.Error.html#isValid"><span class="hs-identifier hs-var">isValid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(TyCon -&gt; Validity) -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#checkRepTyCon"><span class="hs-identifier hs-var">checkRepTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalFFITyCon"><span class="hs-identifier hs-var">legalFFITyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861882"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-2195"></span><span>
</span><span id="line-2196"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIArgumentTy"><span class="hs-identifier hs-type">isFFIArgumentTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.ForeignCall.html#Safety"><span class="hs-identifier hs-type">Safety</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2197"></span><span class="hs-comment">-- Checks for valid argument type for a 'foreign import'</span><span>
</span><span id="line-2198"></span><span id="isFFIArgumentTy"><span class="annot"><span class="annottext">isFFIArgumentTy :: DynFlags -&gt; Safety -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#isFFIArgumentTy"><span class="hs-identifier hs-var hs-var">isFFIArgumentTy</span></a></span></span><span> </span><span id="local-6989586621680861879"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861879"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680861878"><span class="annot"><span class="annottext">Safety
</span><a href="#local-6989586621680861878"><span class="hs-identifier hs-var">safety</span></a></span></span><span> </span><span id="local-6989586621680861877"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861877"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-2199"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Validity) -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#checkRepTyCon"><span class="hs-identifier hs-var">checkRepTyCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Safety -&gt; TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalOutgoingTyCon"><span class="hs-identifier hs-var">legalOutgoingTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861879"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Safety
</span><a href="#local-6989586621680861878"><span class="hs-identifier hs-var">safety</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861877"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2200"></span><span>
</span><span id="line-2201"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIExternalTy"><span class="hs-identifier hs-type">isFFIExternalTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2202"></span><span class="hs-comment">-- Types that are allowed as arguments of a 'foreign export'</span><span>
</span><span id="line-2203"></span><span id="isFFIExternalTy"><span class="annot"><span class="annottext">isFFIExternalTy :: Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#isFFIExternalTy"><span class="hs-identifier hs-var hs-var">isFFIExternalTy</span></a></span></span><span> </span><span id="local-6989586621680861875"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861875"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Validity) -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#checkRepTyCon"><span class="hs-identifier hs-var">checkRepTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalFEArgTyCon"><span class="hs-identifier hs-var">legalFEArgTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861875"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2204"></span><span>
</span><span id="line-2205"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIImportResultTy"><span class="hs-identifier hs-type">isFFIImportResultTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2206"></span><span id="isFFIImportResultTy"><span class="annot"><span class="annottext">isFFIImportResultTy :: DynFlags -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#isFFIImportResultTy"><span class="hs-identifier hs-var hs-var">isFFIImportResultTy</span></a></span></span><span> </span><span id="local-6989586621680861873"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861873"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680861872"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861872"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-2207"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Validity) -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#checkRepTyCon"><span class="hs-identifier hs-var">checkRepTyCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalFIResultTyCon"><span class="hs-identifier hs-var">legalFIResultTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861873"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861872"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2208"></span><span>
</span><span id="line-2209"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIExportResultTy"><span class="hs-identifier hs-type">isFFIExportResultTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2210"></span><span id="isFFIExportResultTy"><span class="annot"><span class="annottext">isFFIExportResultTy :: Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#isFFIExportResultTy"><span class="hs-identifier hs-var hs-var">isFFIExportResultTy</span></a></span></span><span> </span><span id="local-6989586621680861870"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861870"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Validity) -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#checkRepTyCon"><span class="hs-identifier hs-var">checkRepTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalFEResultTyCon"><span class="hs-identifier hs-var">legalFEResultTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861870"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2211"></span><span>
</span><span id="line-2212"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIDynTy"><span class="hs-identifier hs-type">isFFIDynTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2213"></span><span class="hs-comment">-- The type in a foreign import dynamic must be Ptr, FunPtr, or a newtype of</span><span>
</span><span id="line-2214"></span><span class="hs-comment">-- either, and the wrapped function type must be equal to the given type.</span><span>
</span><span id="line-2215"></span><span class="hs-comment">-- We assume that all types have been run through normaliseFfiType, so we don't</span><span>
</span><span id="line-2216"></span><span class="hs-comment">-- need to worry about expanding newtypes here.</span><span>
</span><span id="line-2217"></span><span id="isFFIDynTy"><span class="annot"><span class="annottext">isFFIDynTy :: Type -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#isFFIDynTy"><span class="hs-identifier hs-var hs-var">isFFIDynTy</span></a></span></span><span> </span><span id="local-6989586621680861868"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861868"><span class="hs-identifier hs-var">expected</span></a></span></span><span> </span><span id="local-6989586621680861867"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861867"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-2218"></span><span>    </span><span class="hs-comment">-- Note [Foreign import dynamic]</span><span>
</span><span id="line-2219"></span><span>    </span><span class="hs-comment">-- In the example below, expected would be 'CInt -&gt; IO ()', while ty would</span><span>
</span><span id="line-2220"></span><span>    </span><span class="hs-comment">-- be 'FunPtr (CDouble -&gt; IO ())'.</span><span>
</span><span id="line-2221"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680861866"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861866"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span id="local-6989586621680861865"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861865"><span class="hs-identifier hs-var">ty'</span></a></span></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861867"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2222"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique
</span><a href="GHC.Core.TyCon.html#tyConUnique"><span class="hs-identifier hs-var hs-var">tyConUnique</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861866"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">Unique -&gt; [Unique] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#ptrTyConKey"><span class="hs-identifier hs-var">ptrTyConKey</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#funPtrTyConKey"><span class="hs-identifier hs-var">funPtrTyConKey</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-2223"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-identifier hs-var">eqType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861865"><span class="hs-identifier hs-var">ty'</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861868"><span class="hs-identifier hs-var">expected</span></a></span><span>
</span><span id="line-2224"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-2225"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-2226"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Expected: Ptr/FunPtr&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
</span><a href="GHC.Core.TyCo.Ppr.html#pprParendType"><span class="hs-identifier hs-var">pprParendType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861868"><span class="hs-identifier hs-var">expected</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#comma"><span class="hs-identifier hs-var">comma</span></a></span><span>
</span><span id="line-2227"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  Actual:&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861867"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-2228"></span><span>
</span><span id="line-2229"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFILabelTy"><span class="hs-identifier hs-type">isFFILabelTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2230"></span><span class="hs-comment">-- The type of a foreign label must be Ptr, FunPtr, or a newtype of either.</span><span>
</span><span id="line-2231"></span><span id="isFFILabelTy"><span class="annot"><span class="annottext">isFFILabelTy :: Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#isFFILabelTy"><span class="hs-identifier hs-var hs-var">isFFILabelTy</span></a></span></span><span> </span><span id="local-6989586621680861856"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861856"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Validity) -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#checkRepTyCon"><span class="hs-identifier hs-var">checkRepTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Validity
forall {a}. Uniquable a =&gt; a -&gt; Validity
</span><a href="#local-6989586621680861855"><span class="hs-identifier hs-var">ok</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861856"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2232"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-2233"></span><span>    </span><span id="local-6989586621680861855"><span class="annot"><span class="annottext">ok :: a -&gt; Validity
</span><a href="#local-6989586621680861855"><span class="hs-identifier hs-var hs-var">ok</span></a></span></span><span> </span><span id="local-6989586621680861851"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680861851"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680861851"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#funPtrTyConKey"><span class="hs-identifier hs-var">funPtrTyConKey</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680861851"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#ptrTyConKey"><span class="hs-identifier hs-var">ptrTyConKey</span></a></span><span>
</span><span id="line-2234"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-2235"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-2236"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;A foreign-imported address (via &amp;foo) must have type (Ptr a) or (FunPtr a)&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-2237"></span><span>
</span><span id="line-2238"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIPrimArgumentTy"><span class="hs-identifier hs-type">isFFIPrimArgumentTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2239"></span><span class="hs-comment">-- Checks for valid argument type for a 'foreign import prim'</span><span>
</span><span id="line-2240"></span><span class="hs-comment">-- Currently they must all be simple unlifted types, or the well-known type</span><span>
</span><span id="line-2241"></span><span class="hs-comment">-- Any, which can be used to pass the address to a Haskell object on the heap to</span><span>
</span><span id="line-2242"></span><span class="hs-comment">-- the foreign function.</span><span>
</span><span id="line-2243"></span><span id="isFFIPrimArgumentTy"><span class="annot"><span class="annottext">isFFIPrimArgumentTy :: DynFlags -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#isFFIPrimArgumentTy"><span class="hs-identifier hs-var hs-var">isFFIPrimArgumentTy</span></a></span></span><span> </span><span id="local-6989586621680861850"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861850"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680861849"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861849"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-2244"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAnyTy"><span class="hs-identifier hs-var">isAnyTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861849"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-2245"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Validity) -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#checkRepTyCon"><span class="hs-identifier hs-var">checkRepTyCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalFIPrimArgTyCon"><span class="hs-identifier hs-var">legalFIPrimArgTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861850"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861849"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2246"></span><span>
</span><span id="line-2247"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFFIPrimResultTy"><span class="hs-identifier hs-type">isFFIPrimResultTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2248"></span><span class="hs-comment">-- Checks for valid result type for a 'foreign import prim' Currently</span><span>
</span><span id="line-2249"></span><span class="hs-comment">-- it must be an unlifted type, including unboxed tuples, unboxed</span><span>
</span><span id="line-2250"></span><span class="hs-comment">-- sums, or the well-known type Any.</span><span>
</span><span id="line-2251"></span><span id="isFFIPrimResultTy"><span class="annot"><span class="annottext">isFFIPrimResultTy :: DynFlags -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#isFFIPrimResultTy"><span class="hs-identifier hs-var hs-var">isFFIPrimResultTy</span></a></span></span><span> </span><span id="local-6989586621680861847"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861847"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680861846"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861846"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-2252"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isAnyTy"><span class="hs-identifier hs-var">isAnyTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861846"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-2253"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Validity) -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#checkRepTyCon"><span class="hs-identifier hs-var">checkRepTyCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalFIPrimResultTyCon"><span class="hs-identifier hs-var">legalFIPrimResultTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861847"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861846"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2254"></span><span>
</span><span id="line-2255"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isFunPtrTy"><span class="hs-identifier hs-type">isFunPtrTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2256"></span><span id="isFunPtrTy"><span class="annot"><span class="annottext">isFunPtrTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isFunPtrTy"><span class="hs-identifier hs-var hs-var">isFunPtrTy</span></a></span></span><span> </span><span id="local-6989586621680861844"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861844"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-2257"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680861843"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861843"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861844"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2258"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861843"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#funPtrTyConKey"><span class="hs-identifier hs-var">funPtrTyConKey</span></a></span><span>
</span><span id="line-2259"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-2260"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-2261"></span><span>
</span><span id="line-2262"></span><span class="hs-comment">-- normaliseFfiType gets run before checkRepTyCon, so we don't</span><span>
</span><span id="line-2263"></span><span class="hs-comment">-- need to worry about looking through newtypes or type functions</span><span>
</span><span id="line-2264"></span><span class="hs-comment">-- here; that's already been taken care of.</span><span>
</span><span id="line-2265"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#checkRepTyCon"><span class="hs-identifier hs-type">checkRepTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2266"></span><span id="checkRepTyCon"><span class="annot"><span class="annottext">checkRepTyCon :: (TyCon -&gt; Validity) -&gt; Type -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#checkRepTyCon"><span class="hs-identifier hs-var hs-var">checkRepTyCon</span></a></span></span><span> </span><span id="local-6989586621680861842"><span class="annot"><span class="annottext">TyCon -&gt; Validity
</span><a href="#local-6989586621680861842"><span class="hs-identifier hs-var">check_tc</span></a></span></span><span> </span><span id="local-6989586621680861841"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861841"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-2267"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861841"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-2268"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680861840"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861840"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680861839"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861839"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-2269"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isNewTyCon"><span class="hs-identifier hs-var">isNewTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861840"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; Arity -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680861836"><span class="hs-identifier hs-var">msg</span></a></span><span> </span><span class="annot"><span class="annottext">Arity
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; SDoc
forall {t :: * -&gt; *} {a} {a}.
(Foldable t, Outputable a) =&gt;
a -&gt; t a -&gt; SDoc
</span><a href="#local-6989586621680861835"><span class="hs-identifier hs-var">mk_nt_reason</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861840"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861839"><span class="hs-identifier hs-var">tys</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680861834"><span class="hs-identifier hs-var">nt_fix</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-2270"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Validity
</span><a href="#local-6989586621680861842"><span class="hs-identifier hs-var">check_tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861840"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-2271"></span><span>                             </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-2272"></span><span>                             </span><span class="annot"><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-type">NotValid</span></a></span><span> </span><span id="local-6989586621680861833"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680861833"><span class="hs-identifier hs-var">extra</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680861836"><span class="hs-identifier hs-var">msg</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680861833"><span class="hs-identifier hs-var">extra</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-2273"></span><span>      </span><span class="annot"><span class="annottext">Maybe (TyCon, [Type])
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861841"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;is not a data type&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-2274"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-2275"></span><span>    </span><span id="local-6989586621680861836"><span class="annot"><span class="annottext">msg :: SDoc
</span><a href="#local-6989586621680861836"><span class="hs-identifier hs-var hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861841"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;cannot be marshalled in a foreign call&quot;</span></span><span>
</span><span id="line-2276"></span><span>    </span><span id="local-6989586621680861835"><span class="annot"><span class="annottext">mk_nt_reason :: a -&gt; t a -&gt; SDoc
</span><a href="#local-6989586621680861835"><span class="hs-identifier hs-var hs-var">mk_nt_reason</span></a></span></span><span> </span><span id="local-6989586621680861826"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680861826"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680861825"><span class="annot"><span class="annottext">t a
</span><a href="#local-6989586621680861825"><span class="hs-identifier hs-var">tys</span></a></span></span><span>
</span><span id="line-2277"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">t a -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">t a
</span><a href="#local-6989586621680861825"><span class="hs-identifier hs-var">tys</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;because its data constructor is not in scope&quot;</span></span><span>
</span><span id="line-2278"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;because the data constructor for&quot;</span></span><span>
</span><span id="line-2279"></span><span>                    </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680861826"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;is not in scope&quot;</span></span><span>
</span><span id="line-2280"></span><span>    </span><span id="local-6989586621680861834"><span class="annot"><span class="annottext">nt_fix :: SDoc
</span><a href="#local-6989586621680861834"><span class="hs-identifier hs-var hs-var">nt_fix</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Possible fix: import the data constructor to bring it into scope&quot;</span></span><span>
</span><span id="line-2281"></span><span>
</span><span id="line-2282"></span><span class="hs-comment">{-
Note [Foreign import dynamic]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A dynamic stub must be of the form 'FunPtr ft -&gt; ft' where ft is any foreign
type.  Similarly, a wrapper stub must be of the form 'ft -&gt; IO (FunPtr ft)'.

We use isFFIDynTy to check whether a signature is well-formed. For example,
given a (illegal) declaration like:

foreign import ccall &quot;dynamic&quot;
  foo :: FunPtr (CDouble -&gt; IO ()) -&gt; CInt -&gt; IO ()

isFFIDynTy will compare the 'FunPtr' type 'CDouble -&gt; IO ()' with the curried
result type 'CInt -&gt; IO ()', and return False, as they are not equal.


----------------------------------------------
These chaps do the work; they are not exported
----------------------------------------------
-}</span><span>
</span><span id="line-2302"></span><span>
</span><span id="line-2303"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#legalFEArgTyCon"><span class="hs-identifier hs-type">legalFEArgTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2304"></span><span id="legalFEArgTyCon"><span class="annot"><span class="annottext">legalFEArgTyCon :: TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalFEArgTyCon"><span class="hs-identifier hs-var hs-var">legalFEArgTyCon</span></a></span></span><span> </span><span id="local-6989586621680861824"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861824"><span class="hs-identifier hs-var">tc</span></a></span></span><span>
</span><span id="line-2305"></span><span>  </span><span class="hs-comment">-- It's illegal to make foreign exports that take unboxed</span><span>
</span><span id="line-2306"></span><span>  </span><span class="hs-comment">-- arguments.  The RTS API currently can't invoke such things.  --SDM 7/2000</span><span>
</span><span id="line-2307"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#boxedMarshalableTyCon"><span class="hs-identifier hs-var">boxedMarshalableTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861824"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-2308"></span><span>
</span><span id="line-2309"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#legalFIResultTyCon"><span class="hs-identifier hs-type">legalFIResultTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2310"></span><span id="legalFIResultTyCon"><span class="annot"><span class="annottext">legalFIResultTyCon :: DynFlags -&gt; TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalFIResultTyCon"><span class="hs-identifier hs-var hs-var">legalFIResultTyCon</span></a></span></span><span> </span><span id="local-6989586621680861822"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861822"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680861821"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861821"><span class="hs-identifier hs-var">tc</span></a></span></span><span>
</span><span id="line-2311"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861821"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; TyCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#unitTyCon"><span class="hs-identifier hs-var">unitTyCon</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-2312"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#marshalableTyCon"><span class="hs-identifier hs-var">marshalableTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861822"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861821"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-2313"></span><span>
</span><span id="line-2314"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#legalFEResultTyCon"><span class="hs-identifier hs-type">legalFEResultTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2315"></span><span id="legalFEResultTyCon"><span class="annot"><span class="annottext">legalFEResultTyCon :: TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalFEResultTyCon"><span class="hs-identifier hs-var hs-var">legalFEResultTyCon</span></a></span></span><span> </span><span id="local-6989586621680861819"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861819"><span class="hs-identifier hs-var">tc</span></a></span></span><span>
</span><span id="line-2316"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861819"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; TyCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#unitTyCon"><span class="hs-identifier hs-var">unitTyCon</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-2317"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#boxedMarshalableTyCon"><span class="hs-identifier hs-var">boxedMarshalableTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861819"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-2318"></span><span>
</span><span id="line-2319"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#legalOutgoingTyCon"><span class="hs-identifier hs-type">legalOutgoingTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.ForeignCall.html#Safety"><span class="hs-identifier hs-type">Safety</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2320"></span><span class="hs-comment">-- Checks validity of types going from Haskell -&gt; external world</span><span>
</span><span id="line-2321"></span><span id="legalOutgoingTyCon"><span class="annot"><span class="annottext">legalOutgoingTyCon :: DynFlags -&gt; Safety -&gt; TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalOutgoingTyCon"><span class="hs-identifier hs-var hs-var">legalOutgoingTyCon</span></a></span></span><span> </span><span id="local-6989586621680861818"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861818"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="annot"><span class="annottext">Safety
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680861817"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861817"><span class="hs-identifier hs-var">tc</span></a></span></span><span>
</span><span id="line-2322"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#marshalableTyCon"><span class="hs-identifier hs-var">marshalableTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861818"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861817"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-2323"></span><span>
</span><span id="line-2324"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#legalFFITyCon"><span class="hs-identifier hs-type">legalFFITyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2325"></span><span class="hs-comment">-- True for any TyCon that can possibly be an arg or result of an FFI call</span><span>
</span><span id="line-2326"></span><span id="legalFFITyCon"><span class="annot"><span class="annottext">legalFFITyCon :: TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalFFITyCon"><span class="hs-identifier hs-var hs-var">legalFFITyCon</span></a></span></span><span> </span><span id="local-6989586621680861816"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861816"><span class="hs-identifier hs-var">tc</span></a></span></span><span>
</span><span id="line-2327"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isUnliftedTyCon"><span class="hs-identifier hs-var">isUnliftedTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861816"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-2328"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861816"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; TyCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#unitTyCon"><span class="hs-identifier hs-var">unitTyCon</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-2329"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#boxedMarshalableTyCon"><span class="hs-identifier hs-var">boxedMarshalableTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861816"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-2330"></span><span>
</span><span id="line-2331"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#marshalableTyCon"><span class="hs-identifier hs-type">marshalableTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2332"></span><span id="marshalableTyCon"><span class="annot"><span class="annottext">marshalableTyCon :: DynFlags -&gt; TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#marshalableTyCon"><span class="hs-identifier hs-var hs-var">marshalableTyCon</span></a></span></span><span> </span><span id="local-6989586621680861814"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861814"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680861813"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861813"><span class="hs-identifier hs-var">tc</span></a></span></span><span>
</span><span id="line-2333"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isUnliftedTyCon"><span class="hs-identifier hs-var">isUnliftedTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861813"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-2334"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isUnboxedTupleTyCon"><span class="hs-identifier hs-var">isUnboxedTupleTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861813"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isUnboxedSumTyCon"><span class="hs-identifier hs-var">isUnboxedSumTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861813"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-2335"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[PrimRep] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; TyCon -&gt; [PrimRep]
TyCon -&gt; [PrimRep]
</span><a href="GHC.Types.RepType.html#tyConPrimRep"><span class="hs-identifier hs-var">tyConPrimRep</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861813"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Note [Marshalling void]</span><span>
</span><span id="line-2336"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#validIfUnliftedFFITypes"><span class="hs-identifier hs-var">validIfUnliftedFFITypes</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861814"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-2337"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-2338"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#boxedMarshalableTyCon"><span class="hs-identifier hs-var">boxedMarshalableTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861813"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-2339"></span><span>
</span><span id="line-2340"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#boxedMarshalableTyCon"><span class="hs-identifier hs-type">boxedMarshalableTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2341"></span><span id="boxedMarshalableTyCon"><span class="annot"><span class="annottext">boxedMarshalableTyCon :: TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#boxedMarshalableTyCon"><span class="hs-identifier hs-var hs-var">boxedMarshalableTyCon</span></a></span></span><span> </span><span id="local-6989586621680861808"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861808"><span class="hs-identifier hs-var">tc</span></a></span></span><span>
</span><span id="line-2342"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Unique
forall a. Uniquable a =&gt; a -&gt; Unique
</span><a href="GHC.Types.Unique.html#getUnique"><span class="hs-identifier hs-var">getUnique</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861808"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">Unique -&gt; [Unique] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#intTyConKey"><span class="hs-identifier hs-var">intTyConKey</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#int8TyConKey"><span class="hs-identifier hs-var">int8TyConKey</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#int16TyConKey"><span class="hs-identifier hs-var">int16TyConKey</span></a></span><span>
</span><span id="line-2343"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#int32TyConKey"><span class="hs-identifier hs-var">int32TyConKey</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#int64TyConKey"><span class="hs-identifier hs-var">int64TyConKey</span></a></span><span>
</span><span id="line-2344"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#wordTyConKey"><span class="hs-identifier hs-var">wordTyConKey</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#word8TyConKey"><span class="hs-identifier hs-var">word8TyConKey</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#word16TyConKey"><span class="hs-identifier hs-var">word16TyConKey</span></a></span><span>
</span><span id="line-2345"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#word32TyConKey"><span class="hs-identifier hs-var">word32TyConKey</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#word64TyConKey"><span class="hs-identifier hs-var">word64TyConKey</span></a></span><span>
</span><span id="line-2346"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#floatTyConKey"><span class="hs-identifier hs-var">floatTyConKey</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#doubleTyConKey"><span class="hs-identifier hs-var">doubleTyConKey</span></a></span><span>
</span><span id="line-2347"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#ptrTyConKey"><span class="hs-identifier hs-var">ptrTyConKey</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#funPtrTyConKey"><span class="hs-identifier hs-var">funPtrTyConKey</span></a></span><span>
</span><span id="line-2348"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#charTyConKey"><span class="hs-identifier hs-var">charTyConKey</span></a></span><span>
</span><span id="line-2349"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#stablePtrTyConKey"><span class="hs-identifier hs-var">stablePtrTyConKey</span></a></span><span>
</span><span id="line-2350"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#boolTyConKey"><span class="hs-identifier hs-var">boolTyConKey</span></a></span><span>
</span><span id="line-2351"></span><span>                         </span><span class="hs-special">]</span><span>
</span><span id="line-2352"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-2353"></span><span>
</span><span id="line-2354"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-2355"></span><span>
</span><span id="line-2356"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#legalFIPrimArgTyCon"><span class="hs-identifier hs-type">legalFIPrimArgTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2357"></span><span class="hs-comment">-- Check args of 'foreign import prim', only allow simple unlifted types.</span><span>
</span><span id="line-2358"></span><span class="hs-comment">-- Strictly speaking it is unnecessary to ban unboxed tuples and sums here since</span><span>
</span><span id="line-2359"></span><span class="hs-comment">-- currently they're of the wrong kind to use in function args anyway.</span><span>
</span><span id="line-2360"></span><span id="legalFIPrimArgTyCon"><span class="annot"><span class="annottext">legalFIPrimArgTyCon :: DynFlags -&gt; TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalFIPrimArgTyCon"><span class="hs-identifier hs-var hs-var">legalFIPrimArgTyCon</span></a></span></span><span> </span><span id="local-6989586621680861797"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861797"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680861796"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861796"><span class="hs-identifier hs-var">tc</span></a></span></span><span>
</span><span id="line-2361"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isUnliftedTyCon"><span class="hs-identifier hs-var">isUnliftedTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861796"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-2362"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isUnboxedTupleTyCon"><span class="hs-identifier hs-var">isUnboxedTupleTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861796"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isUnboxedSumTyCon"><span class="hs-identifier hs-var">isUnboxedSumTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861796"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-2363"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#validIfUnliftedFFITypes"><span class="hs-identifier hs-var">validIfUnliftedFFITypes</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861797"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-2364"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-2365"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Tc.Utils.TcType.html#unlifted_only"><span class="hs-identifier hs-var">unlifted_only</span></a></span><span>
</span><span id="line-2366"></span><span>
</span><span id="line-2367"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#legalFIPrimResultTyCon"><span class="hs-identifier hs-type">legalFIPrimResultTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2368"></span><span class="hs-comment">-- Check result type of 'foreign import prim'. Allow simple unlifted</span><span>
</span><span id="line-2369"></span><span class="hs-comment">-- types and also unboxed tuple and sum result types.</span><span>
</span><span id="line-2370"></span><span id="legalFIPrimResultTyCon"><span class="annot"><span class="annottext">legalFIPrimResultTyCon :: DynFlags -&gt; TyCon -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#legalFIPrimResultTyCon"><span class="hs-identifier hs-var hs-var">legalFIPrimResultTyCon</span></a></span></span><span> </span><span id="local-6989586621680861794"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861794"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680861793"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861793"><span class="hs-identifier hs-var">tc</span></a></span></span><span>
</span><span id="line-2371"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isUnliftedTyCon"><span class="hs-identifier hs-var">isUnliftedTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861793"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-2372"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isUnboxedTupleTyCon"><span class="hs-identifier hs-var">isUnboxedTupleTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861793"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isUnboxedSumTyCon"><span class="hs-identifier hs-var">isUnboxedSumTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861793"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-2373"></span><span>     </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[PrimRep] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; TyCon -&gt; [PrimRep]
TyCon -&gt; [PrimRep]
</span><a href="GHC.Types.RepType.html#tyConPrimRep"><span class="hs-identifier hs-var">tyConPrimRep</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861793"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>   </span><span class="hs-comment">-- Note [Marshalling void]</span><span>
</span><span id="line-2374"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#validIfUnliftedFFITypes"><span class="hs-identifier hs-var">validIfUnliftedFFITypes</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861794"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-2375"></span><span>
</span><span id="line-2376"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-2377"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Tc.Utils.TcType.html#unlifted_only"><span class="hs-identifier hs-var">unlifted_only</span></a></span><span>
</span><span id="line-2378"></span><span>
</span><span id="line-2379"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#unlifted_only"><span class="hs-identifier hs-type">unlifted_only</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#MsgDoc"><span class="hs-identifier hs-type">MsgDoc</span></a></span><span>
</span><span id="line-2380"></span><span id="unlifted_only"><span class="annot"><span class="annottext">unlifted_only :: SDoc
</span><a href="GHC.Tc.Utils.TcType.html#unlifted_only"><span class="hs-identifier hs-var hs-var">unlifted_only</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;foreign import prim only accepts simple unlifted types&quot;</span></span><span>
</span><span id="line-2381"></span><span>
</span><span id="line-2382"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#validIfUnliftedFFITypes"><span class="hs-identifier hs-type">validIfUnliftedFFITypes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-2383"></span><span id="validIfUnliftedFFITypes"><span class="annot"><span class="annottext">validIfUnliftedFFITypes :: DynFlags -&gt; Validity
</span><a href="GHC.Tc.Utils.TcType.html#validIfUnliftedFFITypes"><span class="hs-identifier hs-var hs-var">validIfUnliftedFFITypes</span></a></span></span><span> </span><span id="local-6989586621680861792"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861792"><span class="hs-identifier hs-var">dflags</span></a></span></span><span>
</span><span id="line-2384"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Extension -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#xopt"><span class="hs-identifier hs-var">xopt</span></a></span><span> </span><span class="annot"><span class="annottext">Extension
</span><a href="../../ghc-boot-th/src/GHC.LanguageExtensions.Type.html#UnliftedFFITypes"><span class="hs-identifier hs-var">LangExt.UnliftedFFITypes</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680861792"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-2385"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;To marshal unlifted types, use UnliftedFFITypes&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-2386"></span><span>
</span><span id="line-2387"></span><span class="hs-comment">{-
Note [Marshalling void]
~~~~~~~~~~~~~~~~~~~~~~~
We don't treat State# (whose PrimRep is VoidRep) as marshalable.
In turn that means you can't write
        foreign import foo :: Int -&gt; State# RealWorld

Reason: the back end falls over with panic &quot;primRepHint:VoidRep&quot;;
        and there is no compelling reason to permit it
-}</span><span>
</span><span id="line-2397"></span><span>
</span><span id="line-2398"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
        The &quot;Paterson size&quot; of a type
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-2405"></span><span>
</span><span id="line-2406"></span><span class="hs-comment">{-
Note [Paterson conditions on PredTypes]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We are considering whether *class* constraints terminate
(see Note [Paterson conditions]). Precisely, the Paterson conditions
would have us check that &quot;the constraint has fewer constructors and variables
(taken together and counting repetitions) than the head.&quot;.

However, we can be a bit more refined by looking at which kind of constraint
this actually is. There are two main tricks:

 1. It seems like it should be OK not to count the tuple type constructor
    for a PredType like (Show a, Eq a) :: Constraint, since we don't
    count the &quot;implicit&quot; tuple in the ThetaType itself.

    In fact, the Paterson test just checks *each component* of the top level
    ThetaType against the size bound, one at a time. By analogy, it should be
    OK to return the size of the *largest* tuple component as the size of the
    whole tuple.

 2. Once we get into an implicit parameter or equality we
    can't get back to a class constraint, so it's safe
    to say &quot;size 0&quot;.  See #4200.

NB: we don't want to detect PredTypes in sizeType (and then call
sizePred on them), or we might get an infinite loop if that PredType
is irreducible. See #5581.
-}</span><span>
</span><span id="line-2434"></span><span>
</span><span id="line-2435"></span><span class="hs-keyword">type</span><span> </span><span id="TypeSize"><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TypeSize"><span class="hs-identifier hs-var">TypeSize</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#IntWithInf"><span class="hs-identifier hs-type">IntWithInf</span></a></span><span>
</span><span id="line-2436"></span><span>
</span><span id="line-2437"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#sizeType"><span class="hs-identifier hs-type">sizeType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TypeSize"><span class="hs-identifier hs-type">TypeSize</span></a></span><span>
</span><span id="line-2438"></span><span class="hs-comment">-- Size of a type: the number of variables and constructors</span><span>
</span><span id="line-2439"></span><span class="hs-comment">-- Ignore kinds altogether</span><span>
</span><span id="line-2440"></span><span id="sizeType"><span class="annot"><span class="annottext">sizeType :: Type -&gt; TypeSize
</span><a href="GHC.Tc.Utils.TcType.html#sizeType"><span class="hs-identifier hs-var hs-var">sizeType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; TypeSize
</span><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-2441"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-2442"></span><span>    </span><span id="local-6989586621680861788"><span class="annot"><span class="annottext">go :: Type -&gt; TypeSize
</span><a href="#local-6989586621680861788"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680861772"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861772"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680861771"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861771"><span class="hs-identifier hs-var">exp_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#tcView"><span class="hs-identifier hs-var">tcView</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861772"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; TypeSize
</span><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861771"><span class="hs-identifier hs-var">exp_ty</span></a></span><span>
</span><span id="line-2443"></span><span>    </span><span class="annot"><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyVarTy"><span class="hs-identifier hs-type">TyVarTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TypeSize
</span><span class="hs-number">1</span></span><span>
</span><span id="line-2444"></span><span>    </span><span class="annot"><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyConApp"><span class="hs-identifier hs-type">TyConApp</span></a></span><span> </span><span id="local-6989586621680861770"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861770"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680861769"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861769"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-2445"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isTypeFamilyTyCon"><span class="hs-identifier hs-var">isTypeFamilyTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861770"><span class="hs-identifier hs-var">tc</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TypeSize
</span><a href="GHC.Types.Basic.html#infinity"><span class="hs-identifier hs-var">infinity</span></a></span><span>  </span><span class="hs-comment">-- Type-family applications can</span><span>
</span><span id="line-2446"></span><span>                                             </span><span class="hs-comment">-- expand to any arbitrary size</span><span>
</span><span id="line-2447"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; TypeSize
</span><a href="GHC.Tc.Utils.TcType.html#sizeTypes"><span class="hs-identifier hs-var">sizeTypes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; [Type]
</span><a href="GHC.Core.Type.html#filterOutInvisibleTypes"><span class="hs-identifier hs-var">filterOutInvisibleTypes</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861770"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861769"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TypeSize -&gt; TypeSize -&gt; TypeSize
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">TypeSize
</span><span class="hs-number">1</span></span><span>
</span><span id="line-2448"></span><span>                                   </span><span class="hs-comment">-- Why filter out invisible args?  I suppose any</span><span>
</span><span id="line-2449"></span><span>                                   </span><span class="hs-comment">-- size ordering is sound, but why is this better?</span><span>
</span><span id="line-2450"></span><span>                                   </span><span class="hs-comment">-- I came across this when investigating #14010.</span><span>
</span><span id="line-2451"></span><span>    </span><span class="annot"><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#LitTy"><span class="hs-identifier hs-type">LitTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TypeSize
</span><span class="hs-number">1</span></span><span>
</span><span id="line-2452"></span><span>    </span><span class="annot"><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#FunTy"><span class="hs-identifier hs-type">FunTy</span></a></span><span> </span><span class="annot"><span class="annottext">AnonArgFlag
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680861767"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861767"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621680861766"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861766"><span class="hs-identifier hs-var">arg</span></a></span></span><span> </span><span id="local-6989586621680861765"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861765"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; TypeSize
</span><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861767"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">TypeSize -&gt; TypeSize -&gt; TypeSize
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; TypeSize
</span><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861766"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="annot"><span class="annottext">TypeSize -&gt; TypeSize -&gt; TypeSize
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; TypeSize
</span><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861765"><span class="hs-identifier hs-var">res</span></a></span><span> </span><span class="annot"><span class="annottext">TypeSize -&gt; TypeSize -&gt; TypeSize
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">TypeSize
</span><span class="hs-number">1</span></span><span>
</span><span id="line-2453"></span><span>    </span><span class="annot"><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AppTy"><span class="hs-identifier hs-type">AppTy</span></a></span><span> </span><span id="local-6989586621680861764"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861764"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span id="local-6989586621680861763"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861763"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">)</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; TypeSize
</span><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861764"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">TypeSize -&gt; TypeSize -&gt; TypeSize
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; TypeSize
</span><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861763"><span class="hs-identifier hs-var">arg</span></a></span><span>
</span><span id="line-2454"></span><span>    </span><span class="annot"><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ForAllTy"><span class="hs-identifier hs-type">ForAllTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Bndr"><span class="hs-identifier hs-type">Bndr</span></a></span><span> </span><span id="local-6989586621680861762"><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861762"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span id="local-6989586621680861761"><span class="annot"><span class="annottext">ArgFlag
</span><a href="#local-6989586621680861761"><span class="hs-identifier hs-var">vis</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680861760"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861760"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-2455"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ArgFlag -&gt; Bool
</span><a href="GHC.Types.Var.html#isVisibleArgFlag"><span class="hs-identifier hs-var">isVisibleArgFlag</span></a></span><span> </span><span class="annot"><span class="annottext">ArgFlag
</span><a href="#local-6989586621680861761"><span class="hs-identifier hs-var">vis</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; TypeSize
</span><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVar -&gt; Type
</span><a href="GHC.Types.Var.html#tyVarKind"><span class="hs-identifier hs-var">tyVarKind</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVar
</span><a href="#local-6989586621680861762"><span class="hs-identifier hs-var">tv</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TypeSize -&gt; TypeSize -&gt; TypeSize
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; TypeSize
</span><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861760"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">TypeSize -&gt; TypeSize -&gt; TypeSize
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">TypeSize
</span><span class="hs-number">1</span></span><span>
</span><span id="line-2456"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; TypeSize
</span><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861760"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">TypeSize -&gt; TypeSize -&gt; TypeSize
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">TypeSize
</span><span class="hs-number">1</span></span><span>
</span><span id="line-2457"></span><span>    </span><span class="annot"><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CastTy"><span class="hs-identifier hs-type">CastTy</span></a></span><span> </span><span id="local-6989586621680861758"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861758"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="annot"><span class="annottext">KindCoercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; TypeSize
</span><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861758"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-2458"></span><span>    </span><span class="annot"><a href="#local-6989586621680861788"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionTy"><span class="hs-identifier hs-type">CoercionTy</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TypeSize
</span><span class="hs-number">0</span></span><span>
</span><span id="line-2459"></span><span>
</span><span id="line-2460"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#sizeTypes"><span class="hs-identifier hs-type">sizeTypes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TypeSize"><span class="hs-identifier hs-type">TypeSize</span></a></span><span>
</span><span id="line-2461"></span><span id="sizeTypes"><span class="annot"><span class="annottext">sizeTypes :: [Type] -&gt; TypeSize
</span><a href="GHC.Tc.Utils.TcType.html#sizeTypes"><span class="hs-identifier hs-var hs-var">sizeTypes</span></a></span></span><span> </span><span id="local-6989586621680861757"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861757"><span class="hs-identifier hs-var">tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TypeSize] -&gt; TypeSize
forall (t :: * -&gt; *) a. (Foldable t, Num a) =&gt; t a -&gt; a
</span><a href="../../base/src/Data.Foldable.html#sum"><span class="hs-identifier hs-var">sum</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Type -&gt; TypeSize) -&gt; [Type] -&gt; [TypeSize]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; TypeSize
</span><a href="GHC.Tc.Utils.TcType.html#sizeType"><span class="hs-identifier hs-var">sizeType</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861757"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-2462"></span><span>
</span><span id="line-2463"></span><span class="hs-comment">-----------------------------------------------------------------------------------</span><span>
</span><span id="line-2464"></span><span class="hs-comment">-----------------------------------------------------------------------------------</span><span>
</span><span id="line-2465"></span><span class="hs-comment">-----------------------</span><span>
</span><span id="line-2466"></span><span class="hs-comment">-- | For every arg a tycon can take, the returned list says True if the argument</span><span>
</span><span id="line-2467"></span><span class="hs-comment">-- is taken visibly, and False otherwise. Ends with an infinite tail of Trues to</span><span>
</span><span id="line-2468"></span><span class="hs-comment">-- allow for oversaturation.</span><span>
</span><span id="line-2469"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#tcTyConVisibilities"><span class="hs-identifier hs-type">tcTyConVisibilities</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">]</span><span>
</span><span id="line-2470"></span><span id="tcTyConVisibilities"><span class="annot"><span class="annottext">tcTyConVisibilities :: TyCon -&gt; [Bool]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyConVisibilities"><span class="hs-identifier hs-var hs-var">tcTyConVisibilities</span></a></span></span><span> </span><span id="local-6989586621680861755"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861755"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680861754"><span class="hs-identifier hs-var">tc_binder_viss</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; [Bool] -&gt; [Bool]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621680861753"><span class="hs-identifier hs-var">tc_return_kind_viss</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; [Bool] -&gt; [Bool]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; [Bool]
forall a. a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#repeat"><span class="hs-identifier hs-var">repeat</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-2471"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-2472"></span><span>    </span><span id="local-6989586621680861754"><span class="annot"><span class="annottext">tc_binder_viss :: [Bool]
</span><a href="#local-6989586621680861754"><span class="hs-identifier hs-var hs-var">tc_binder_viss</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyConBinder -&gt; Bool) -&gt; [TyConBinder] -&gt; [Bool]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">TyConBinder -&gt; Bool
forall tv. VarBndr tv TyConBndrVis -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isVisibleTyConBinder"><span class="hs-identifier hs-var">isVisibleTyConBinder</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [TyConBinder]
</span><a href="GHC.Core.TyCon.html#tyConBinders"><span class="hs-identifier hs-var hs-var">tyConBinders</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861755"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-2473"></span><span>    </span><span id="local-6989586621680861753"><span class="annot"><span class="annottext">tc_return_kind_viss :: [Bool]
</span><a href="#local-6989586621680861753"><span class="hs-identifier hs-var hs-var">tc_return_kind_viss</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyBinder -&gt; Bool) -&gt; [TyBinder] -&gt; [Bool]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">TyBinder -&gt; Bool
</span><a href="GHC.Core.TyCo.Rep.html#isVisibleBinder"><span class="hs-identifier hs-var">isVisibleBinder</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">([TyBinder], Type) -&gt; [TyBinder]
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">(([TyBinder], Type) -&gt; [TyBinder])
-&gt; ([TyBinder], Type) -&gt; [TyBinder]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; ([TyBinder], Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitPiTys"><span class="hs-identifier hs-var">tcSplitPiTys</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Type
</span><a href="GHC.Core.TyCon.html#tyConResKind"><span class="hs-identifier hs-var hs-var">tyConResKind</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861755"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-2474"></span><span>
</span><span id="line-2475"></span><span class="hs-comment">-- | If the tycon is applied to the types, is the next argument visible?</span><span>
</span><span id="line-2476"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isNextTyConArgVisible"><span class="hs-identifier hs-type">isNextTyConArgVisible</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2477"></span><span id="isNextTyConArgVisible"><span class="annot"><span class="annottext">isNextTyConArgVisible :: TyCon -&gt; [Type] -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isNextTyConArgVisible"><span class="hs-identifier hs-var hs-var">isNextTyConArgVisible</span></a></span></span><span> </span><span id="local-6989586621680861750"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861750"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621680861749"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861749"><span class="hs-identifier hs-var">tys</span></a></span></span><span>
</span><span id="line-2478"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Bool]
</span><a href="GHC.Tc.Utils.TcType.html#tcTyConVisibilities"><span class="hs-identifier hs-var">tcTyConVisibilities</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680861750"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; Arity -&gt; Bool
forall a. Outputable a =&gt; [a] -&gt; Arity -&gt; a
</span><a href="GHC.Data.List.SetOps.html#getNth"><span class="hs-operator hs-var">`getNth`</span></a></span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; Arity
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Arity
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680861749"><span class="hs-identifier hs-var">tys</span></a></span><span>
</span><span id="line-2479"></span><span>
</span><span id="line-2480"></span><span class="hs-comment">-- | Should this type be applied to a visible argument?</span><span>
</span><span id="line-2481"></span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#isNextArgVisible"><span class="hs-identifier hs-type">isNextArgVisible</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-2482"></span><span id="isNextArgVisible"><span class="annot"><span class="annottext">isNextArgVisible :: Type -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isNextArgVisible"><span class="hs-identifier hs-var hs-var">isNextArgVisible</span></a></span></span><span> </span><span id="local-6989586621680861748"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861748"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-2483"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680861747"><span class="annot"><span class="annottext">TyBinder
</span><a href="#local-6989586621680861747"><span class="hs-identifier hs-var">bndr</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (TyBinder, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitPiTy_maybe"><span class="hs-identifier hs-var">tcSplitPiTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680861748"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyBinder -&gt; Bool
</span><a href="GHC.Core.TyCo.Rep.html#isVisibleBinder"><span class="hs-identifier hs-var">isVisibleBinder</span></a></span><span> </span><span class="annot"><span class="annottext">TyBinder
</span><a href="#local-6989586621680861747"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-2484"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-2485"></span><span>    </span><span class="hs-comment">-- this second case might happen if, say, we have an unzonked TauTv.</span><span>
</span><span id="line-2486"></span><span>    </span><span class="hs-comment">-- But TauTvs can't range over types that take invisible arguments</span><span>
</span><span id="line-2487"></span></pre></body></html>